ESPHome
2026.6.0-dev
Loading...
Searching...
No Matches
esphome
components
teleinfo
sensor
teleinfo_sensor.cpp
Go to the documentation of this file.
1
#include "
esphome/core/log.h
"
2
#include "
teleinfo_sensor.h
"
3
4
namespace
esphome::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 esphome::teleinfo
esphome::sensor::Sensor::publish_state
void publish_state(float state)
Publish a new state to the front-end.
Definition
sensor.cpp:68
esphome::teleinfo::TeleInfoListener::tag
std::string tag
Definition
teleinfo.h:20
esphome::teleinfo::TeleInfoSensor::dump_config
void dump_config() override
Definition
teleinfo_sensor.cpp:12
esphome::teleinfo::TeleInfoSensor::TeleInfoSensor
TeleInfoSensor(const char *tag)
Definition
teleinfo_sensor.cpp:7
esphome::teleinfo::TeleInfoSensor::publish_val
void publish_val(const std::string &val) override
Definition
teleinfo_sensor.cpp:8
log.h
val
mopeka_std_values val[3]
Definition
mopeka_std_check.h:8
esphome::teleinfo
Definition
teleinfo_sensor.cpp:4
esphome::tag
const char * tag
Definition
log.h:74
esphome::parse_number
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
Definition
helpers.h:1143
teleinfo_sensor.h
Generated by
1.12.0