ESPHome  2024.11.0
teleinfo_sensor.cpp
Go to the documentation of this file.
1 #include "esphome/core/log.h"
2 #include "teleinfo_sensor.h"
3 namespace esphome {
4 namespace teleinfo {
5 
6 static const char *const TAG = "teleinfo_sensor";
7 TeleInfoSensor::TeleInfoSensor(const char *tag) { this->tag = std::string(tag); }
8 void TeleInfoSensor::publish_val(const std::string &val) {
9  auto newval = parse_number<float>(val).value_or(0.0f);
10  publish_state(newval);
11 }
12 void TeleInfoSensor::dump_config() { LOG_SENSOR(" ", "Teleinfo Sensor", this); }
13 } // namespace teleinfo
14 } // namespace esphome
mopeka_std_values val[4]
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:39
void publish_val(const std::string &val) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7