1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-05 11:23:47 +01:00

[dsmr] Add internal 'telegram' text_sensor to support bridging (#6841)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
marcovaneck
2024-09-10 10:22:58 +02:00
committed by GitHub
parent c8aed15157
commit de7d2c33e1
3 changed files with 19 additions and 2 deletions

View File

@@ -256,6 +256,7 @@ bool Dsmr::parse_telegram() {
MyData data;
ESP_LOGV(TAG, "Trying to parse telegram");
this->stop_requesting_data_();
::dsmr::ParseResult<void> res =
::dsmr::P1Parser::parse(&data, this->telegram_, this->bytes_read_, false,
this->crc_check_); // Parse telegram according to data definition. Ignore unknown values.
@@ -267,6 +268,11 @@ bool Dsmr::parse_telegram() {
} else {
this->status_clear_warning();
this->publish_sensors(data);
// publish the telegram, after publishing the sensors so it can also trigger action based on latest values
if (this->s_telegram_ != nullptr) {
this->s_telegram_->publish_state(std::string(this->telegram_, this->bytes_read_));
}
return true;
}
}