7static const char *
const TAG =
"nextion_sensor";
13#ifdef USE_NEXTION_WAVEFORM
20 ESP_LOGD(TAG,
"Sensor: %s=%d", variable_name.c_str(),
state);
24#ifdef USE_NEXTION_WAVEFORM
29 if (this->
wave_buffer_.size() > (
size_t) this->wave_max_length_) {
39#ifdef USE_NEXTION_WAVEFORM
57 if (std::isnan(
state))
60#ifdef USE_NEXTION_WAVEFORM
73 if (send_to_nextion) {
79 double to_multiply = pow(10, this->
precision_);
80 int state_value = (int) (
state * to_multiply);
88 float published_state =
state;
91 double to_multiply = pow(10, -this->
precision_);
92 published_state = (float) (
state * to_multiply);
98 ESP_LOGN(TAG,
"Write: %s=%lf", this->
variable_name_.c_str(), published_state);
101#ifdef USE_NEXTION_WAVEFORM
106#ifdef NEXTION_PROTOCOL_LOG
107 size_t buffer_to_send =
109 ESP_LOGN(TAG,
"Wave update: %zu/%zu vals to comp %d ch %d", buffer_to_send, this->
wave_buffer_.size(),
110 this->component_id_, this->wave_chan_id_);
virtual void add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value)=0
virtual void add_addt_command_to_queue(NextionComponentBase *component)=0
virtual void add_to_get_queue(NextionComponentBase *component)=0
std::string variable_name_
std::vector< uint8_t > wave_buffer_
bool needs_to_send_update_
void update_component_settings() override
void add_to_wave_buffer(float state)
void set_state(float state) override
void process_sensor(const std::string &variable_name, int state) override
void publish_state(float state)
Publish a new state to the front-end.
float state
This member variable stores the last state that has passed through all filters.