ESPHome
2024.10.2
esphome
esphome
components
micronova
text_sensor
micronova_text_sensor.cpp
Go to the documentation of this file.
1
#include "
micronova_text_sensor.h
"
2
3
namespace
esphome
{
4
namespace
micronova {
5
6
void
MicroNovaTextSensor::process_value_from_stove
(
int
value_from_stove) {
7
if
(value_from_stove == -1) {
8
this->
publish_state
(
"unknown"
);
9
return
;
10
}
11
12
switch
(this->
get_function
()) {
13
case
MicroNovaFunctions::STOVE_FUNCTION_STOVE_STATE
:
14
this->
micronova_
->
set_current_stove_state
(value_from_stove);
15
this->
publish_state
(STOVE_STATES[value_from_stove]);
16
// set the stove switch to on for any value but 0
17
if
(value_from_stove != 0 && this->
micronova_
->
get_stove_switch
() !=
nullptr
&&
18
!this->
micronova_
->
get_stove_switch
()->
get_stove_state
()) {
19
this->
micronova_
->
get_stove_switch
()->
set_stove_state
(
true
);
20
}
else
if
(value_from_stove == 0 && this->
micronova_
->
get_stove_switch
() !=
nullptr
&&
21
this->
micronova_
->
get_stove_switch
()->
get_stove_state
()) {
22
this->
micronova_
->
get_stove_switch
()->
set_stove_state
(
false
);
23
}
24
break
;
25
default
:
26
break
;
27
}
28
}
29
30
}
// namespace micronova
31
}
// namespace esphome
esphome::micronova::MicroNovaBaseListener::get_function
MicroNovaFunctions get_function()
Definition:
micronova.h:58
esphome::micronova::MicroNova::get_stove_switch
MicroNovaSwitchListener * get_stove_switch()
Definition:
micronova.h:141
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition:
text_sensor.cpp:9
esphome::micronova::MicroNovaTextSensor::process_value_from_stove
void process_value_from_stove(int value_from_stove) override
Definition:
micronova_text_sensor.cpp:6
micronova_text_sensor.h
esphome::micronova::MicroNova::set_current_stove_state
void set_current_stove_state(uint8_t s)
Definition:
micronova.h:137
esphome::micronova::MicroNovaSwitchListener::get_stove_state
virtual bool get_stove_state()=0
esphome::micronova::MicroNovaSwitchListener::set_stove_state
virtual void set_stove_state(bool v)=0
esphome::micronova::MicroNovaBaseListener::micronova_
MicroNova * micronova_
Definition:
micronova.h:67
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::micronova::MicroNovaFunctions::STOVE_FUNCTION_STOVE_STATE
Generated by
1.8.13