mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 23:45:40 -07:00
* teleinfo: handle historical mode correctly.
In historical mode, tags like PTEC leads to an issue where we detect a
timestamp wheras this is not possible in historical mode.
PTEC teleinfo tag looks like:
PTEC HP..
Instead of the usual format
IINST1 001 I
This make our data parsing fails.
While at here, make sure we continue parsing other tags even if parsing
one of the tag fails.
Signed-off-by: 0hax <0hax@protonmail.com>
* teleinfo: fix compilation with loglevel set to debug.
Signed-off-by: 0hax <0hax@protonmail.com>
15 lines
485 B
C++
15 lines
485 B
C++
#include "esphome/core/log.h"
|
|
#include "teleinfo_sensor.h"
|
|
namespace esphome {
|
|
namespace teleinfo {
|
|
|
|
static const char *const TAG = "teleinfo_sensor";
|
|
TeleInfoSensor::TeleInfoSensor(const char *tag) { this->tag = std::string(tag); }
|
|
void TeleInfoSensor::publish_val(const std::string &val) {
|
|
auto newval = parse_float(val);
|
|
publish_state(*newval);
|
|
}
|
|
void TeleInfoSensor::dump_config() { LOG_SENSOR(" ", "Teleinfo Sensor", this); }
|
|
} // namespace teleinfo
|
|
} // namespace esphome
|