8static const char *
const TAG =
"nextion_sensor";
16 ESP_LOGD(TAG,
"Processed sensor \"%s\" state %d", variable_name.c_str(),
state);
27 if (this->
wave_buffer_.size() > (
size_t) this->wave_max_length_) {
51 if (std::isnan(
state))
55 if (send_to_nextion) {
62 double to_multiply = pow(10, this->
precision_);
63 int state_value = (int) (
state * to_multiply);
79 float published_state =
state;
83 double to_multiply = pow(10, -this->
precision_);
84 published_state = (float) (
state * to_multiply);
96 ESP_LOGN(TAG,
"Wrote state for sensor \"%s\" state %lf", this->
variable_name_.c_str(), published_state);
104#ifdef NEXTION_PROTOCOL_LOG
105 size_t buffer_to_send =
108 ESP_LOGN(TAG,
"wave_update send %zu of %zu value(s) to wave nextion component id %d and wave channel id %d",
109 buffer_to_send, this->
wave_buffer_.size(), 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.
float raw_state
This member variable stores the current raw state of the sensor, without any filters applied.
Providing packet encoding functions for exchanging data with a remote host.