8 static const char *
const TAG =
"nextion_sensor";
16 ESP_LOGD(TAG,
"Processed sensor \"%s\" state %d", variable_name.c_str(),
state);
23 int wave_state = (int) ((state / (
float) this->
wave_maxvalue_) * 100);
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",
std::string variable_name_
void update_component_settings() override
void add_to_wave_buffer(float state)
bool needs_to_send_update_
std::vector< uint8_t > wave_buffer_
float raw_state
This member variable stores the current raw state of the sensor, without any filters applied...
float state
This member variable stores the last state that has passed through all filters.
void process_sensor(const std::string &variable_name, int state) override
virtual void add_to_get_queue(NextionComponentBase *component)=0
virtual void add_addt_command_to_queue(NextionComponentBase *component)=0
void publish_state(float state)
Publish a new state to the front-end.
virtual void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value)=0
Implementation of SPI Controller mode.
void set_state(float state) override