ESPHome 2025.5.0
Loading...
Searching...
No Matches
teleinfo_sensor.cpp
Go to the documentation of this file.
1#include "esphome/core/log.h"
2#include "teleinfo_sensor.h"
3namespace esphome {
4namespace teleinfo {
5
6static const char *const TAG = "teleinfo_sensor";
7TeleInfoSensor::TeleInfoSensor(const char *tag) { this->tag = std::string(tag); }
8void TeleInfoSensor::publish_val(const std::string &val) {
9 auto newval = parse_number<float>(val).value_or(0.0f);
10 publish_state(newval);
11}
12void TeleInfoSensor::dump_config() { LOG_SENSOR(" ", "Teleinfo Sensor", this); }
13} // namespace teleinfo
14} // namespace esphome
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
mopeka_std_values val[4]
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
Definition helpers.h:313