improve dump_config output of sensors.

This commit is contained in:
Your Name 2023-03-14 16:04:45 +01:00
parent 223b59a228
commit 3bc1015f79
6 changed files with 12 additions and 12 deletions

View File

@ -5,7 +5,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.binary_sensor"; static const char *const TAG = "truma_inetbox.cpplus_binary_sensor";
void TrumaCpPlusBinarySensor::update() { void TrumaCpPlusBinarySensor::update() {
if (this->parent_->get_lin_bus_fault() || (this->parent_->get_last_cp_plus_request() == 0)) { if (this->parent_->get_lin_bus_fault() || (this->parent_->get_last_cp_plus_request() == 0)) {
@ -16,6 +16,6 @@ void TrumaCpPlusBinarySensor::update() {
this->publish_state(micros() < timeout); this->publish_state(micros() < timeout);
} }
void TrumaCpPlusBinarySensor::dump_config() { ESP_LOGCONFIG("", "Truma CP Plus Binary Sensor"); } void TrumaCpPlusBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Truma CP Plus Binary Sensor", this); }
} // namespace truma_inetbox } // namespace truma_inetbox
} // namespace esphome } // namespace esphome

View File

@ -5,7 +5,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.binary_sensor"; static const char *const TAG = "truma_inetbox.heater_binary_sensor";
void TrumaHeaterBinarySensor::setup() { void TrumaHeaterBinarySensor::setup() {
this->parent_->register_listener([this](const StatusFrameHeater *status_heater) { this->parent_->register_listener([this](const StatusFrameHeater *status_heater) {
@ -37,7 +37,7 @@ void TrumaHeaterBinarySensor::setup() {
} }
void TrumaHeaterBinarySensor::dump_config() { void TrumaHeaterBinarySensor::dump_config() {
ESP_LOGCONFIG("", "Truma Heater Binary Sensor"); LOG_BINARY_SENSOR("", "Truma Heater Binary Sensor", this);
ESP_LOGCONFIG(TAG, " Type '%s'", enum_to_c_str(this->type_)); ESP_LOGCONFIG(TAG, " Type '%s'", enum_to_c_str(this->type_));
} }
} // namespace truma_inetbox } // namespace truma_inetbox

View File

@ -5,7 +5,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.binary_sensor"; static const char *const TAG = "truma_inetbox.timer_binary_sensor";
void TrumaTimerBinarySensor::setup() { void TrumaTimerBinarySensor::setup() {
this->parent_->register_listener([this](const StatusFrameTimer *status_timer) { this->parent_->register_listener([this](const StatusFrameTimer *status_timer) {
@ -26,7 +26,7 @@ void TrumaTimerBinarySensor::setup() {
} }
void TrumaTimerBinarySensor::dump_config() { void TrumaTimerBinarySensor::dump_config() {
ESP_LOGCONFIG("", "Truma Timer Binary Sensor"); LOG_BINARY_SENSOR("", "Truma Timer Binary Sensor", this);
ESP_LOGCONFIG(TAG, " Type %s", enum_to_c_str(this->type_)); ESP_LOGCONFIG(TAG, " Type %s", enum_to_c_str(this->type_));
} }
} // namespace truma_inetbox } // namespace truma_inetbox

View File

@ -4,7 +4,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.truma_room_climate"; static const char *const TAG = "truma_inetbox.room_climate";
void TrumaRoomClimate::setup() { void TrumaRoomClimate::setup() {
this->parent_->register_listener([this](const StatusFrameHeater *status_heater) { this->parent_->register_listener([this](const StatusFrameHeater *status_heater) {
// Publish updated state // Publish updated state
@ -32,7 +32,7 @@ void TrumaRoomClimate::setup() {
}); });
} }
void TrumaRoomClimate::dump_config() { ESP_LOGCONFIG(TAG, "Truma Room Climate"); } void TrumaRoomClimate::dump_config() { LOG_CLIMATE(TAG, "Truma Room Climate", this); }
void TrumaRoomClimate::control(const climate::ClimateCall &call) { void TrumaRoomClimate::control(const climate::ClimateCall &call) {
if (call.get_target_temperature().has_value()) { if (call.get_target_temperature().has_value()) {

View File

@ -4,7 +4,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.truma_water_climate"; static const char *const TAG = "truma_inetbox.water_climate";
void TrumaWaterClimate::setup() { void TrumaWaterClimate::setup() {
this->parent_->register_listener([this](const StatusFrameHeater *status_heater) { this->parent_->register_listener([this](const StatusFrameHeater *status_heater) {
// Publish updated state // Publish updated state
@ -16,7 +16,7 @@ void TrumaWaterClimate::setup() {
}); });
} }
void TrumaWaterClimate::dump_config() { ESP_LOGCONFIG(TAG, "Truma Climate"); } void TrumaWaterClimate::dump_config() { LOG_CLIMATE(TAG, "Truma Climate", this); }
void TrumaWaterClimate::control(const climate::ClimateCall &call) { void TrumaWaterClimate::control(const climate::ClimateCall &call) {
if (call.get_target_temperature().has_value()) { if (call.get_target_temperature().has_value()) {

View File

@ -5,7 +5,7 @@
namespace esphome { namespace esphome {
namespace truma_inetbox { namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.sensor"; static const char *const TAG = "truma_inetbox.heater_number";
void TrumaHeaterNumber::setup() { void TrumaHeaterNumber::setup() {
this->parent_->register_listener([this](const StatusFrameHeater *status_heater) { this->parent_->register_listener([this](const StatusFrameHeater *status_heater) {
@ -38,7 +38,7 @@ void TrumaHeaterNumber::control(float value) {
} }
void TrumaHeaterNumber::dump_config() { void TrumaHeaterNumber::dump_config() {
ESP_LOGCONFIG("", "Truma Heater Number"); LOG_NUMBER("", "Truma Heater Number", this);
ESP_LOGCONFIG(TAG, " Type '%s'", enum_to_c_str(this->type_)); ESP_LOGCONFIG(TAG, " Type '%s'", enum_to_c_str(this->type_));
} }
} // namespace truma_inetbox } // namespace truma_inetbox