14 #ifdef USE_NEXTION_TFT_UPLOAD 16 #include <HTTPClient.h> 19 #include <ESP8266HTTPClient.h> 20 #include <WiFiClientSecure.h> 28 class NextionComponentBase;
32 static const std::string COMMAND_DELIMITER{
static_cast<char>(255), static_cast<char>(255),
static_cast<char>(255)};
436 void fill_area(
int x1,
int y1,
int width,
int height,
const char *color);
454 void fill_area(
int x1,
int y1,
int width,
int height,
Color color);
473 void line(
int x1,
int y1,
int x2,
int y2,
const char *color);
492 void line(
int x1,
int y1,
int x2,
int y2,
Color color);
511 void rectangle(
int x1,
int y1,
int width,
int height,
const char *color);
530 void rectangle(
int x1,
int y1,
int width,
int height,
Color color);
538 void circle(
int center_x,
int center_y,
int radius,
const char *color);
546 void circle(
int center_x,
int center_y,
int radius,
Color color);
563 void filled_circle(
int center_x,
int center_y,
int radius,
const char *color);
668 void setup()
override;
672 void loop()
override;
686 #ifdef USE_NEXTION_TFT_UPLOAD 749 int state_value)
override;
753 const std::string &state_value)
override;
771 uint16_t
recv_ret_string_(std::string &response, uint32_t timeout,
bool recv_flag);
798 __attribute__((format(printf, 3, 4)));
802 __attribute__((format(printf, 3, 4)));
805 const
std::
string &variable_name_to_send,
int state_value,
806 bool is_sleep_safe = false);
809 const
std::
string &variable_name_to_send,
810 const
std::
string &state_value,
bool is_sleep_safe = false);
814 #ifdef USE_NEXTION_TFT_UPLOAD 844 #endif // USE_NEXTION_TFT_UPLOAD 850 std::vector<NextionComponentBase *>
touch_;
870 #ifdef USE_NEXTION_TFT_UPLOAD 877 #ifdef NEXTION_PROTOCOL_LOG 880 void reset_(
bool reset_nextion =
true);
void goto_page(const char *page)
Show the page with a given name.
void set_nextion_rtc_time(ESPTime time)
Send the current time to the nextion display.
bool ignore_is_setup_
Sends commands ignoring of the Nextion has been setup.
void all_components_send_state_(bool force_update=false)
CallbackManager< void(uint8_t)> page_callback_
CallbackManager< void()> sleep_callback_
void line(int x1, int y1, int x2, int y2, const char *color)
Draw a line on the screen.
void set_protocol_reparse_mode(bool active_mode)
Sets Nextion Protocol Reparse mode between active or passive.
void set_component_pic(const char *component, uint8_t pic_id)
Set the picture id of a component.
void add_new_page_callback(std::function< void(uint8_t)> &&callback)
Add a callback to be notified when the nextion changes pages.
void set_start_up_page_internal(uint8_t start_up_page)
void upload_tft()
Upload the tft file and softreset the Nextion.
void add_wake_state_callback(std::function< void()> &&callback)
Add a callback to be notified of wake state changes.
WiFiClient * get_wifi_client_()
void hide_component(const char *component) override
Hide a component.
bool send_command_printf(const char *format,...) __attribute__((format(printf
Manually send a raw formatted command to the display.
void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value) override
void add_addt_command_to_queue(NextionComponentBase *component) override
Add addt command to the queue.
void circle(int center_x, int center_y, int radius, const char *color)
Draw a circle outline.
void set_component_pressed_background_color(const char *component, uint32_t color)
Set the pressed background color of a component.
uint32_t startup_override_ms_
void add_to_get_queue(NextionComponentBase *component) override
std::vector< NextionComponentBase * > touch_
optional< nextion_writer_t > writer_
void update_all_components()
void filled_circle(int center_x, int center_y, int radius, const char *color)
Draw a filled circled.
bool void set_tft_url(const std::string &tft_url)
Set the tft file URL.
A more user-friendly version of struct tm from time.h.
void add_setup_state_callback(std::function< void()> &&callback)
Add a callback to be notified when the nextion completes its initialize setup.
bool sent_setup_commands_
int upload_by_chunks_(HTTPClient *http, int range_start)
bool send_command_(const std::string &command)
Manually send a raw command to the display and don't wait for an acknowledgement packet.
void set_component_coordinates(const char *component, int x, int y)
Set the coordinates of a component on screen.
float get_setup_priority() const override
void set_wake_up_page_internal(uint8_t wake_up_page)
std::string serial_number_
void set_brightness(float brightness)
void register_binarysensor_component(NextionComponentBase *obj)
void register_touch_component(NextionComponentBase *obj)
void set_component_picc(const char *component, uint8_t pic_id)
Set the background picture id of component.
void sleep(bool sleep)
Sets Nextion mode between sleep and awake.
This class simplifies creating components that periodically check a state.
BearSSL::WiFiClientSecure * wifi_client_secure_
void disable_component_touch(const char *component)
Disable touch for a component.
bool void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, const std::string &variable_name_to_send, int state_value, bool is_sleep_safe=false)
void set_component_picture(const char *component, const char *picture)
Set the picture of an image component.
void set_component_pressed_font_color(const char *component, uint32_t color)
Set the pressed font color of a component.
void show_component(const char *component) override
Show a component.
void rectangle(int x1, int y1, int width, int height, const char *color)
Draw a rectangle outline.
void void set_component_value(const char *component, int value)
Set the integer value of a component.
bool nextion_reports_is_setup_
void open_waveform_channel(int component_id, uint8_t channel_number, uint8_t value)
bool upload_with_range_(uint32_t range_start, uint32_t range_end)
void register_sensor_component(NextionComponentBase *obj)
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.
void add_sleep_state_callback(std::function< void()> &&callback)
Add a callback to be notified of sleep state changes.
void register_switch_component(NextionComponentBase *obj)
void add_waveform_data(int component_id, uint8_t channel_number, uint8_t value)
Add waveform data to a waveform component.
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_component_background_color(const char *component, uint32_t color)
Set the background color of a component.
void set_nextion_sensor_state(int queue_type, const std::string &name, float state)
Set the nextion sensor state object.
CallbackManager< void()> setup_callback_
void set_nextion_text_state(const std::string &name, const std::string &state)
void set_wait_for_ack(bool wait_for_ack)
void set_touch_sleep_timeout_internal(uint32_t touch_sleep_timeout)
std::deque< NextionQueue * > nextion_queue_
CallbackManager< void()> wake_callback_
void display_picture(int picture_id, int x_start, int y_start)
Display a picture at coordinates.
void set_auto_wake_on_touch_internal(bool auto_wake_on_touch)
void set_component_text(const char *component, const char *text)
Set the text of a component to a static string.
void print_queue_members_()
void add_no_result_to_queue_(const std::string &variable_name)
std::deque< NextionQueue * > waveform_queue_
void fill_area(int x1, int y1, int width, int height, const char *color)
Fill a rectangle with a color.
void set_component_font(const char *component, uint8_t font_id) override
Set the font id for a component.
std::string command_data_
enum esphome::EntityCategory __attribute__
void enable_component_touch(const char *component)
Enable touch for a component.
bool remove_from_q_(bool report_empty=true)
uint8_t * transfer_buffer_
void set_backlight_brightness(float brightness)
Set the brightness of the backlight.
std::string device_model_
void soft_reset()
Softreset the Nextion.
bool add_no_result_to_queue_with_ignore_sleep_printf_(const std::string &variable_name, const char *format,...) __attribute__((format(printf
void register_textsensor_component(NextionComponentBase *obj)
void set_touch_sleep_timeout(uint16_t timeout)
Set the touch sleep timeout of the display.
std::vector< NextionComponentBase * > textsensortype_
void set_wake_up_page(uint8_t page_id=255)
Sets which page Nextion loads when exiting sleep mode.
std::vector< NextionComponentBase * > sensortype_
void dump_config() override
void remove_front_no_sensors_()
void process_nextion_commands_()
std::vector< NextionComponentBase * > switchtype_
bool upload_from_buffer_(const uint8_t *file_buf, size_t buf_size)
start update tft file to nextion.
bool upload_first_chunk_sent_
WiFiClient * wifi_client_
void set_auto_wake_on_touch(bool auto_wake)
Sets if Nextion should auto-wake from sleep when touch press occurs.
Implementation of SPI Controller mode.
void set_start_up_page(uint8_t page_id=255)
Sets which page Nextion loads when connecting to ESPHome.
bool void add_no_result_to_queue_with_command_(const std::string &variable_name, const std::string &command)
void reset_(bool reset_nextion=true)
void update_components_by_prefix(const std::string &prefix)
std::string firmware_version_
size_t transfer_buffer_size_
uint32_t touch_sleep_timeout_
void check_pending_waveform_()
uint16_t recv_ret_string_(std::string &response, uint32_t timeout, bool recv_flag)
std::function< void(Nextion &)> nextion_writer_t
std::vector< NextionComponentBase * > binarysensortype_
int content_length_
will request chunk_size chunks from the web server and send each to the nextion
void set_writer(const nextion_writer_t &writer)
void set_component_font_color(const char *component, uint32_t color)
Set the font color of a component.