ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
pylontech_text_sensor.cpp
Go to the documentation of this file.
3#include "esphome/core/log.h"
4
5namespace esphome::pylontech {
6
7ESPHOME_LOG_TAG(TAG, "pylontech.textsensor");
8
10 ESP_LOGCONFIG(TAG,
11 "Pylontech Text Sensor:\n"
12 " Battery %u",
13 this->bat_num_);
14 LOG_TEXT_SENSOR(" ", "Base state", this->base_state_text_sensor_);
15 LOG_TEXT_SENSOR(" ", "Voltage state", this->voltage_state_text_sensor_);
16 LOG_TEXT_SENSOR(" ", "Current state", this->current_state_text_sensor_);
17 LOG_TEXT_SENSOR(" ", "Temperature state", this->temperature_state_text_sensor_);
18}
19
21 if (this->base_state_text_sensor_ != nullptr) {
22 this->base_state_text_sensor_->publish_state(line->base_st);
23 }
24 if (this->voltage_state_text_sensor_ != nullptr) {
25 this->voltage_state_text_sensor_->publish_state(line->volt_st);
26 }
27 if (this->current_state_text_sensor_ != nullptr) {
28 this->current_state_text_sensor_->publish_state(line->curr_st);
29 }
30 if (this->temperature_state_text_sensor_ != nullptr) {
31 this->temperature_state_text_sensor_->publish_state(line->temp_st);
32 }
33}
34
35} // namespace esphome::pylontech
virtual void on_line_read(LineContents *line)=0
Called only with records for this listener's battery.
ESPHOME_LOG_TAG(TAG, "pylontech")