mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Add Micronova component (#4760)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: Graham Brown <grahambrown11@gmail.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include "micronova_sensor.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace micronova {
|
||||
|
||||
void MicroNovaSensor::process_value_from_stove(int value_from_stove) {
|
||||
if (value_from_stove == -1) {
|
||||
this->publish_state(NAN);
|
||||
return;
|
||||
}
|
||||
|
||||
float new_sensor_value = (float) value_from_stove;
|
||||
switch (this->get_function()) {
|
||||
case MicroNovaFunctions::STOVE_FUNCTION_ROOM_TEMPERATURE:
|
||||
new_sensor_value = new_sensor_value / 2;
|
||||
break;
|
||||
case MicroNovaFunctions::STOVE_FUNCTION_THERMOSTAT_TEMPERATURE:
|
||||
break;
|
||||
case MicroNovaFunctions::STOVE_FUNCTION_FAN_SPEED:
|
||||
new_sensor_value = new_sensor_value == 0 ? 0 : (new_sensor_value * 10) + this->fan_speed_offset_;
|
||||
break;
|
||||
case MicroNovaFunctions::STOVE_FUNCTION_WATER_TEMPERATURE:
|
||||
new_sensor_value = new_sensor_value / 2;
|
||||
break;
|
||||
case MicroNovaFunctions::STOVE_FUNCTION_WATER_PRESSURE:
|
||||
new_sensor_value = new_sensor_value / 10;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->publish_state(new_sensor_value);
|
||||
}
|
||||
|
||||
} // namespace micronova
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user