ESPHome 2025.6.3
Loading...
Searching...
No Matches
nextion.h
Go to the documentation of this file.
1#pragma once
2
3#include <deque>
4#include <vector>
5
7#include "esphome/core/time.h"
8
10#include "nextion_base.h"
11#include "nextion_component.h"
13
14#ifdef USE_NEXTION_TFT_UPLOAD
15#ifdef USE_ARDUINO
16#ifdef USE_ESP32
17#include <HTTPClient.h>
18#endif // USE_ESP32
19#ifdef USE_ESP8266
20#include <ESP8266HTTPClient.h>
21#include <WiFiClientSecure.h>
22#endif // USE_ESP8266
23#elif defined(USE_ESP_IDF)
24#include <esp_http_client.h>
25#endif // ARDUINO vs USE_ESP_IDF
26#endif // USE_NEXTION_TFT_UPLOAD
27
28namespace esphome {
29namespace nextion {
30
31class Nextion;
32class NextionComponentBase;
33
34using nextion_writer_t = std::function<void(Nextion &)>;
35
36static const std::string COMMAND_DELIMITER{static_cast<char>(255), static_cast<char>(255), static_cast<char>(255)};
37
38#ifdef USE_NEXTION_COMMAND_SPACING
40 public:
45 explicit NextionCommandPacer(uint8_t initial_spacing = 0) : spacing_ms_(initial_spacing) {}
46
51 void set_spacing(uint8_t spacing_ms) { spacing_ms_ = spacing_ms; }
52
57 uint8_t get_spacing() const { return spacing_ms_; }
58
63 bool can_send() const { return (millis() - last_command_time_) >= spacing_ms_; }
64
68 void mark_sent() { last_command_time_ = millis(); }
69
70 private:
71 uint8_t spacing_ms_;
72 uint32_t last_command_time_{0};
73};
74#endif // USE_NEXTION_COMMAND_SPACING
75
76class Nextion : public NextionBase, public PollingComponent, public uart::UARTDevice {
77 public:
78#ifdef USE_NEXTION_MAX_COMMANDS_PER_LOOP
86 inline void set_max_commands_per_loop(uint16_t value) { this->max_commands_per_loop_ = value; }
87
92 inline uint16_t get_max_commands_per_loop() const { return this->max_commands_per_loop_; }
93#endif // USE_NEXTION_MAX_COMMANDS_PER_LOOP
94#ifdef USE_NEXTION_MAX_QUEUE_SIZE
99 inline void set_max_queue_size(size_t size) { this->max_queue_size_ = size; }
100
105 inline size_t get_max_queue_size() const { return this->max_queue_size_; }
106#endif // USE_NEXTION_MAX_QUEUE_SIZE
107
108#ifdef USE_NEXTION_COMMAND_SPACING
113 void set_command_spacing(uint32_t spacing_ms) { this->command_pacer_.set_spacing(spacing_ms); }
114#endif // USE_NEXTION_COMMAND_SPACING
115
128 void set_component_text(const char *component, const char *text);
129
145 void set_component_text_printf(const char *component, const char *format, ...) __attribute__((format(printf, 3, 4)));
146
159 void set_component_value(const char *component, int32_t value);
160
173 void set_component_picture(const char *component, uint8_t picture_id);
174
189 void set_component_background_color(const char *component, uint16_t color);
190
204 void set_component_background_color(const char *component, const char *color);
205
219 void set_component_background_color(const char *component, Color color) override;
220
236 void set_component_pressed_background_color(const char *component, uint16_t color);
237
252 void set_component_pressed_background_color(const char *component, const char *color);
253
268 void set_component_pressed_background_color(const char *component, Color color) override;
269
284 void set_component_foreground_color(const char *component, uint16_t color);
285
299 void set_component_foreground_color(const char *component, const char *color);
300
313 void set_component_foreground_color(const char *component, Color color) override;
314
330 void set_component_pressed_foreground_color(const char *component, uint16_t color);
331
346 void set_component_pressed_foreground_color(const char *component, const char *color);
347
362 void set_component_pressed_foreground_color(const char *component, Color color) override;
363
376 void set_component_pic(const char *component, uint8_t pic_id);
377
390 void set_component_picc(const char *component, uint8_t pic_id);
391
406 void set_component_font_color(const char *component, uint16_t color);
407
421 void set_component_font_color(const char *component, const char *color);
422
435 void set_component_font_color(const char *component, Color color) override;
436
451 void set_component_pressed_font_color(const char *component, uint16_t color);
452
466 void set_component_pressed_font_color(const char *component, const char *color);
467
480 void set_component_pressed_font_color(const char *component, Color color) override;
481
495 void set_component_coordinates(const char *component, uint16_t x, uint16_t y);
496
509 void set_component_font(const char *component, uint8_t font_id) override;
510
515 void set_nextion_rtc_time(ESPTime time);
516
528 void goto_page(const char *page);
529
541 void goto_page(uint8_t page);
542
554 void hide_component(const char *component) override;
555
567 void show_component(const char *component) override;
568
580 void enable_component_touch(const char *component);
581
593 void disable_component_touch(const char *component);
594
601 void add_waveform_data(uint8_t component_id, uint8_t channel_number, uint8_t value);
602
603 void open_waveform_channel(uint8_t component_id, uint8_t channel_number, uint8_t value);
604
618 void display_picture(uint16_t picture_id, uint16_t x_start, uint16_t y_start);
619
638 void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color);
639
657 void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color);
658
676 void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color);
677
696 void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
697
715 void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char *color);
716
734 void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, Color color);
735
754 void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color);
755
773 void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color);
774
792 void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color);
793
803 void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color);
804
813 void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color);
814
822 void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color);
823
840 void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color);
841
857 void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color);
858
874 void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color);
875
894 void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size = 200, uint16_t background_color = 65535,
895 uint16_t foreground_color = 0, uint8_t logo_pic = -1, uint8_t border_width = 8);
896
918 void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size,
919 Color background_color = Color(255, 255, 255), Color foreground_color = Color(0, 0, 0),
920 uint8_t logo_pic = -1, uint8_t border_width = 8);
921
933 void set_backlight_brightness(float brightness);
934
948 void set_skip_connection_handshake(bool skip_handshake) { this->skip_connection_handshake_ = skip_handshake; }
949
954 void sleep(bool sleep);
955
975
976 // ======== Nextion Intelligent Series ========
977
992 void set_component_vid(const char *component, uint8_t vid_id);
993
1008 void set_component_drag(const char *component, bool drag);
1009
1024 void set_component_aph(const char *component, uint8_t aph);
1025
1041 void set_component_position(const char *component, uint32_t x, uint32_t y);
1042
1043 // ========== INTERNAL METHODS ==========
1044 // (In most use cases you won't need these)
1045 void register_touch_component(NextionComponentBase *obj) { this->touch_.push_back(obj); }
1050
1051 void setup() override;
1052 void set_brightness(float brightness) { this->brightness_ = brightness; }
1053 float get_setup_priority() const override;
1054 void update() override;
1055 void loop() override;
1056 void set_writer(const nextion_writer_t &writer);
1057
1058 // This function has been deprecated
1059 void set_wait_for_ack(bool wait_for_ack);
1060
1066 bool send_command(const char *command);
1067
1074 bool send_command_printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
1075
1076#ifdef USE_NEXTION_TFT_UPLOAD
1080 void set_tft_url(const std::string &tft_url) { this->tft_url_ = tft_url; }
1081
1102 bool upload_tft(uint32_t baud_rate = 0, bool exit_reparse = true);
1103
1104#endif // USE_NEXTION_TFT_UPLOAD
1105
1106 void dump_config() override;
1107
1111 void soft_reset();
1112
1117 void add_sleep_state_callback(std::function<void()> &&callback);
1118
1123 void add_wake_state_callback(std::function<void()> &&callback);
1124
1129 void add_setup_state_callback(std::function<void()> &&callback);
1130
1135 void add_new_page_callback(std::function<void(uint8_t)> &&callback);
1136
1141 void add_touch_event_callback(std::function<void(uint8_t, uint8_t, bool)> &&callback);
1142
1147 void add_buffer_overflow_event_callback(std::function<void()> &&callback);
1148
1149 void update_all_components();
1150
1163 void set_nextion_sensor_state(int queue_type, const std::string &name, float state);
1164 void set_nextion_sensor_state(NextionQueueType queue_type, const std::string &name, float state);
1165 void set_nextion_text_state(const std::string &name, const std::string &state);
1166
1167 void add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value) override;
1168 void add_no_result_to_queue_with_set(const std::string &variable_name, const std::string &variable_name_to_send,
1169 int32_t state_value) override;
1170
1171 void add_no_result_to_queue_with_set(NextionComponentBase *component, const std::string &state_value) override;
1172 void add_no_result_to_queue_with_set(const std::string &variable_name, const std::string &variable_name_to_send,
1173 const std::string &state_value) override;
1174
1175 void add_to_get_queue(NextionComponentBase *component) override;
1176
1177 void add_addt_command_to_queue(NextionComponentBase *component) override;
1178
1179 void update_components_by_prefix(const std::string &prefix);
1180
1193 void set_touch_sleep_timeout(uint32_t touch_sleep_timeout);
1194
1207 void set_wake_up_page(uint8_t wake_up_page = 255);
1208
1221 void set_start_up_page(uint8_t start_up_page = 255) { this->start_up_page_ = start_up_page; }
1222
1235 void set_auto_wake_on_touch(bool auto_wake_on_touch);
1236
1249 void set_exit_reparse_on_start(bool exit_reparse_on_start) { this->exit_reparse_on_start_ = exit_reparse_on_start; }
1250
1264 size_t queue_size() { return this->nextion_queue_.size(); }
1265
1284 bool is_updating() override;
1285
1303 bool is_connected() { return this->is_connected_; }
1304
1305 protected:
1306#ifdef USE_NEXTION_MAX_COMMANDS_PER_LOOP
1308#endif // USE_NEXTION_MAX_COMMANDS_PER_LOOP
1309#ifdef USE_NEXTION_MAX_QUEUE_SIZE
1311#endif // USE_NEXTION_MAX_QUEUE_SIZE
1312#ifdef USE_NEXTION_COMMAND_SPACING
1314#endif // USE_NEXTION_COMMAND_SPACING
1315 std::deque<NextionQueue *> nextion_queue_;
1316 std::deque<NextionQueue *> waveform_queue_;
1317 uint16_t recv_ret_string_(std::string &response, uint32_t timeout, bool recv_flag);
1318 void all_components_send_state_(bool force_update = false);
1319 uint64_t comok_sent_ = 0;
1320 bool remove_from_q_(bool report_empty = true);
1321
1326 bool ignore_is_setup_ = false;
1327
1330
1332 void process_serial_();
1333 bool is_updating_ = false;
1335 int16_t wake_up_page_ = -1;
1336 int16_t start_up_page_ = -1;
1340
1345 bool send_command_(const std::string &command);
1346 void add_no_result_to_queue_(const std::string &variable_name);
1347 bool add_no_result_to_queue_with_ignore_sleep_printf_(const std::string &variable_name, const char *format, ...)
1348 __attribute__((format(printf, 3, 4)));
1349 void add_no_result_to_queue_with_command_(const std::string &variable_name, const std::string &command);
1350
1351 bool add_no_result_to_queue_with_printf_(const std::string &variable_name, const char *format, ...)
1352 __attribute__((format(printf, 3, 4)));
1353
1354 void add_no_result_to_queue_with_set_internal_(const std::string &variable_name,
1355 const std::string &variable_name_to_send, int32_t state_value,
1356 bool is_sleep_safe = false);
1357
1358 void add_no_result_to_queue_with_set_internal_(const std::string &variable_name,
1359 const std::string &variable_name_to_send,
1360 const std::string &state_value, bool is_sleep_safe = false);
1361
1363
1364#ifdef USE_NEXTION_TFT_UPLOAD
1365#ifdef USE_ESP8266
1366 WiFiClient *wifi_client_{nullptr};
1367 BearSSL::WiFiClientSecure *wifi_client_secure_{nullptr};
1368 WiFiClient *get_wifi_client_();
1369#endif // USE_ESP8266
1370 std::string tft_url_;
1371 uint32_t content_length_ = 0;
1372 int tft_size_ = 0;
1375
1376#ifdef USE_ARDUINO
1384 int upload_by_chunks_(HTTPClient &http_client, uint32_t &range_start);
1385#elif defined(USE_ESP_IDF)
1393 int upload_by_chunks_(esp_http_client_handle_t http_client, uint32_t &range_start);
1394#endif // USE_ARDUINO vs USE_ESP_IDF
1395
1402 bool upload_end_(bool successful);
1403
1408 uint32_t get_free_heap_();
1409
1410#endif // USE_NEXTION_TFT_UPLOAD
1411
1412 bool check_connect_();
1413
1414 std::vector<NextionComponentBase *> touch_;
1415 std::vector<NextionComponentBase *> switchtype_;
1416 std::vector<NextionComponentBase *> sensortype_;
1417 std::vector<NextionComponentBase *> textsensortype_;
1418 std::vector<NextionComponentBase *> binarysensortype_;
1423 CallbackManager<void(uint8_t, uint8_t, bool)> touch_callback_{};
1425
1428
1429 std::string device_model_;
1431 std::string serial_number_;
1432 std::string flash_size_;
1433
1435
1436#ifdef NEXTION_PROTOCOL_LOG
1437 void print_queue_members_();
1438#endif // NEXTION_PROTOCOL_LOG
1439 void reset_(bool reset_nextion = true);
1440
1441 std::string command_data_;
1442 bool is_connected_ = false;
1443 const uint16_t startup_override_ms_ = 8000;
1444 const uint16_t max_q_age_ms_ = 8000;
1445 uint32_t started_ms_ = 0;
1447};
1448
1449} // namespace nextion
1450} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:331
void set_spacing(uint8_t spacing_ms)
Set the minimum time between commands.
Definition nextion.h:51
uint8_t get_spacing() const
Get current command spacing.
Definition nextion.h:57
bool can_send() const
Check if enough time has passed to send next command.
Definition nextion.h:63
void mark_sent()
Mark a command as sent, updating the timing.
Definition nextion.h:68
NextionCommandPacer(uint8_t initial_spacing=0)
Creates command pacer with initial spacing.
Definition nextion.h:45
void add_setup_state_callback(std::function< void()> &&callback)
Add a callback to be notified when the nextion completes its initialize setup.
Definition nextion.cpp:205
void set_skip_connection_handshake(bool skip_handshake)
Sets whether the Nextion display should skip the connection handshake process.
Definition nextion.h:948
void set_component_font_color(const char *component, uint16_t color)
Set the font color of a component.
std::vector< NextionComponentBase * > touch_
Definition nextion.h:1414
void open_waveform_channel(uint8_t component_id, uint8_t channel_number, uint8_t value)
std::vector< NextionComponentBase * > switchtype_
Definition nextion.h:1415
void set_component_drag(const char *component, bool drag)
Set the drag availability of a component.
void add_buffer_overflow_event_callback(std::function< void()> &&callback)
Add a callback to be notified when the nextion reports a buffer overflow.
Definition nextion.cpp:217
std::vector< NextionComponentBase * > binarysensortype_
Definition nextion.h:1418
uint32_t get_free_heap_()
Returns the ESP Free Heap memory.
void set_component_foreground_color(const char *component, uint16_t color)
Set the foreground color of a component.
void set_component_font(const char *component, uint8_t font_id) override
Set the font id for a component.
const uint16_t max_q_age_ms_
Definition nextion.h:1444
const uint16_t startup_override_ms_
Definition nextion.h:1443
bool send_command_(const std::string &command)
Manually send a raw command to the display and don't wait for an acknowledgement packet.
Definition nextion.cpp:29
size_t get_max_queue_size() const
Get the maximum allowed queue size.
Definition nextion.h:105
void set_max_queue_size(size_t size)
Set the maximum allowed queue size.
Definition nextion.h:99
std::vector< NextionComponentBase * > textsensortype_
Definition nextion.h:1417
void set_max_commands_per_loop(uint16_t value)
Set the maximum number of commands to process in each loop iteration.
Definition nextion.h:86
CallbackManager< void(uint8_t)> page_callback_
Definition nextion.h:1422
void set_component_text_printf(const char *component, const char *format,...) __attribute__((format(printf
Set the text of a component to a formatted string.
void set_brightness(float brightness)
Definition nextion.h:1052
void set_component_text(const char *component, const char *text)
Set the text of a component to a static string.
void set_wake_up_page(uint8_t wake_up_page=255)
Sets which page Nextion loads when exiting sleep mode.
optional< nextion_writer_t > writer_
Definition nextion.h:1426
std::string device_model_
Definition nextion.h:1429
void set_nextion_rtc_time(ESPTime time)
Send the current time to the nextion display.
void all_components_send_state_(bool force_update=false)
Definition nextion.cpp:900
void set_start_up_page(uint8_t start_up_page=255)
Sets which page Nextion loads when connecting to ESPHome.
Definition nextion.h:1221
void set_component_pressed_foreground_color(const char *component, uint16_t color)
Set the pressed foreground color of a component.
std::string firmware_version_
Definition nextion.h:1430
void set_nextion_sensor_state(int queue_type, const std::string &name, float state)
Set the nextion sensor state object.
Definition nextion.cpp:848
void add_addt_command_to_queue(NextionComponentBase *component) override
Add addt command to the queue.
Definition nextion.cpp:1190
void soft_reset()
Softreset the Nextion.
void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color)
Draw a filled circled.
bool ignore_is_setup_
Sends commands ignoring of the Nextion has been setup.
Definition nextion.h:1326
void register_textsensor_component(NextionComponentBase *obj)
Definition nextion.h:1049
void add_new_page_callback(std::function< void(uint8_t)> &&callback)
Add a callback to be notified when the nextion changes pages.
Definition nextion.cpp:209
void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color)
Draw a circle outline.
uint16_t max_commands_per_loop_
Definition nextion.h:1307
void enable_component_touch(const char *component)
Enable touch for a component.
void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color)
Draw a rectangle outline.
void add_to_get_queue(NextionComponentBase *component) override
Queue a GET command for a component that expects a response from the Nextion display.
Definition nextion.cpp:1150
void void set_component_value(const char *component, int32_t value)
Set the integer value of a component.
bool send_command_printf(const char *format,...) __attribute__((format(printf
Manually send a raw formatted command to the display.
Definition nextion.cpp:250
void setup() override
Definition nextion.cpp:12
WiFiClient * wifi_client_
Definition nextion.h:1366
void set_component_picture(const char *component, uint8_t picture_id)
Set the picture of an image component.
void set_component_picc(const char *component, uint8_t pic_id)
Set the background picture id of component.
std::deque< NextionQueue * > nextion_queue_
Definition nextion.h:1315
void loop() override
Definition nextion.cpp:291
void set_auto_wake_on_touch(bool auto_wake_on_touch)
Sets if Nextion should auto-wake from sleep when touch press occurs.
bool remove_from_q_(bool report_empty=true)
Definition nextion.cpp:330
bool upload_tft(uint32_t baud_rate=0, bool exit_reparse=true)
Uploads the TFT file to the Nextion display.
bool set_protocol_reparse_mode(bool active_mode)
Sets the Nextion display's protocol reparse mode.
std::vector< NextionComponentBase * > sensortype_
Definition nextion.h:1416
bool upload_end_(bool successful)
Ends the upload process, restart Nextion and, if successful, restarts ESP.
bool void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, const std::string &variable_name_to_send, int32_t state_value, bool is_sleep_safe=false)
Definition nextion.cpp:1103
BearSSL::WiFiClientSecure * wifi_client_secure_
Definition nextion.h:1367
void set_component_coordinates(const char *component, uint16_t x, uint16_t y)
Set the coordinates of a component on screen.
void set_exit_reparse_on_start(bool exit_reparse_on_start)
Sets if Nextion should exit the active reparse mode before the "connect" command is sent.
Definition nextion.h:1249
void sleep(bool sleep)
Sets Nextion mode between sleep and awake.
bool add_no_result_to_queue_with_printf_(const std::string &variable_name, const char *format,...) __attribute__((format(printf
Sends a formatted command to the nextion.
Definition nextion.cpp:1066
CallbackManager< void()> setup_callback_
Definition nextion.h:1419
void hide_component(const char *component) override
Hide a component.
std::string command_data_
Definition nextion.h:1441
void set_component_position(const char *component, uint32_t x, uint32_t y)
Set the position of a component.
optional< float > brightness_
Definition nextion.h:1427
CallbackManager< void()> wake_callback_
Definition nextion.h:1421
void add_sleep_state_callback(std::function< void()> &&callback)
Add a callback to be notified of sleep state changes.
Definition nextion.cpp:197
bool void set_tft_url(const std::string &tft_url)
Set the tft file URL.
Definition nextion.h:1080
void add_waveform_data(uint8_t component_id, uint8_t channel_number, uint8_t value)
Add waveform data to a waveform component.
void disable_component_touch(const char *component)
Disable touch for a component.
bool is_updating() override
Check if the TFT update process is currently running.
Definition nextion.cpp:1232
uint16_t recv_ret_string_(std::string &response, uint32_t timeout, bool recv_flag)
Definition nextion.cpp:939
void set_component_pressed_font_color(const char *component, uint16_t color)
Set the pressed font color of a component.
void register_touch_component(NextionComponentBase *obj)
Definition nextion.h:1045
void goto_page(const char *page)
Show the page with a given name.
void set_touch_sleep_timeout(uint32_t touch_sleep_timeout)
Set the touch sleep timeout of the display.
void set_wait_for_ack(bool wait_for_ack)
void register_switch_component(NextionComponentBase *obj)
Definition nextion.h:1046
size_t queue_size()
Retrieves the number of commands pending in the Nextion command queue.
Definition nextion.h:1264
bool send_command(const char *command)
Manually send a raw command to the display.
Definition nextion.cpp:239
std::string serial_number_
Definition nextion.h:1431
void set_component_pic(const char *component, uint8_t pic_id)
Set the picture id of a component.
CallbackManager< void()> sleep_callback_
Definition nextion.h:1420
void set_component_pressed_background_color(const char *component, uint16_t color)
Set the pressed background color of a component.
float get_setup_priority() const override
Definition nextion.cpp:187
void set_component_vid(const char *component, uint8_t vid_id)
Set the video id of a component.
bool void add_no_result_to_queue_with_command_(const std::string &variable_name, const std::string &command)
Definition nextion.cpp:1031
void set_component_background_color(const char *component, uint16_t color)
Set the background color of a component.
bool is_connected()
Check if the Nextion display is successfully connected.
Definition nextion.h:1303
void reset_(bool reset_nextion=true)
Definition nextion.cpp:135
void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Draw a line on the screen.
void add_no_result_to_queue_(const std::string &variable_name)
Add a command to the Nextion queue that expects no response.
Definition nextion.cpp:998
CallbackManager< void(uint8_t, uint8_t, bool)> touch_callback_
Definition nextion.h:1423
void register_binarysensor_component(NextionComponentBase *obj)
Definition nextion.h:1047
uint16_t get_max_commands_per_loop() const
Get the current maximum number of commands allowed per loop iteration.
Definition nextion.h:92
void dump_config() override
Definition nextion.cpp:145
void set_command_spacing(uint32_t spacing_ms)
Set the command spacing for the display.
Definition nextion.h:113
NextionCommandPacer command_pacer_
Definition nextion.h:1313
void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color)
Fill a rectangle with a color.
void set_nextion_text_state(const std::string &name, const std::string &state)
Definition nextion.cpp:889
std::deque< NextionQueue * > waveform_queue_
Definition nextion.h:1316
bool add_no_result_to_queue_with_ignore_sleep_printf_(const std::string &variable_name, const char *format,...) __attribute__((format(printf
Definition nextion.cpp:1040
void update() override
Definition nextion.cpp:188
void display_picture(uint16_t picture_id, uint16_t x_start, uint16_t y_start)
Display a picture at coordinates.
void add_wake_state_callback(std::function< void()> &&callback)
Add a callback to be notified of wake state changes.
Definition nextion.cpp:201
CallbackManager< void()> buffer_overflow_callback_
Definition nextion.h:1424
void show_component(const char *component) override
Show a component.
void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size=200, uint16_t background_color=65535, uint16_t foreground_color=0, uint8_t logo_pic=-1, uint8_t border_width=8)
Draws a QR code in the screen.
void set_writer(const nextion_writer_t &writer)
Definition nextion.cpp:1227
int upload_by_chunks_(HTTPClient &http_client, uint32_t &range_start)
will request chunk_size chunks from the web server and send each to the nextion
void register_sensor_component(NextionComponentBase *obj)
Definition nextion.h:1048
void add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value) override
Definition nextion.cpp:1093
void add_touch_event_callback(std::function< void(uint8_t, uint8_t, bool)> &&callback)
Add a callback to be notified when Nextion has a touch event.
Definition nextion.cpp:213
void set_component_aph(const char *component, uint8_t aph)
Set the opaqueness (fading) of a component.
void update_components_by_prefix(const std::string &prefix)
Definition nextion.cpp:920
void set_backlight_brightness(float brightness)
Set the brightness of the backlight.
struct @67::@68 __attribute__
bool state
Definition fan.h:0
bool active_mode
std::function< void(Nextion &)> nextion_writer_t
Definition nextion.h:34
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint32_t IRAM_ATTR HOT millis()
Definition core.cpp:28
A more user-friendly version of struct tm from time.h.
Definition time.h:15
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6