From d0b8ba55baaf4a7f4d659cc23ddf5b8a0eff873f Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:32:59 +0100 Subject: [PATCH] Clean-up logs The less the more --- ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml | 2 +- ...TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml | 20 +++++++++++++++---- ...X-Ultimate-Easy-ESPHome_core_hw_touch.yaml | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml index 715d98b..1375536 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml @@ -78,7 +78,7 @@ improv_serial: id: serial_improv logger: - level: DEBUG + level: INFO ota: platform: esphome diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml index b419743..573b88b 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml @@ -844,16 +844,21 @@ script: static const uint32_t LIGHT_TRANSITION_TURN_OFF = ${LIGHT_TRANSITION_TURN_OFF}; static const uint8_t LIGHT_BRIGHTNESS_TURN_ON = ${LIGHT_BRIGHTNESS_TURN_ON}; - ESP_LOGI("core_hw_leds.light_set_state", "Setting light group %d, index %d to state %s", - light_group, light_index, state ? "ON" : "OFF"); + const bool is_model_us = sl_tx_model_format->active_index().has_value() and + sl_tx_model_format->active_index().value() == 1; + const std::string light_mode_group_1 = is_model_us ? "${LIGHT_MODE_LEFT_TEXT}" : "${LIGHT_MODE_BOTTOM_TEXT}"; + const std::string light_mode_group_2 = is_model_us ? "${LIGHT_MODE_RIGHT_TEXT}" : "${LIGHT_MODE_TOP_TEXT}"; switch (light_group) { case 1: if (light_index >= id(gb_lights_1).size()) { - ESP_LOGE("light_set_state", "Invalid light_index %d for group 1", light_index); + ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8, + light_mode_group_1.c_str(), light_index); return; } if (state and !id(gb_lights_1)[light_index]->current_values.is_on()) { + ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8, + light_mode_group_1.c_str(), light_index); auto call = id(gb_lights_1)[light_index]->turn_on(); if (LIGHT_TRANSITION_TURN_ON > 0) call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms @@ -861,6 +866,8 @@ script: call.set_brightness(LIGHT_TRANSITION_TURN_ON / 100.0f); call.perform(); } else if (!state and id(gb_lights_1)[light_index]->current_values.is_on()) { + ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8, + light_mode_group_1.c_str(), light_index); auto call = id(gb_lights_1)[light_index]->turn_off(); if (LIGHT_TRANSITION_TURN_OFF > 0) call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms @@ -869,10 +876,13 @@ script: break; case 2: if (light_index >= id(gb_lights_2).size()) { - ESP_LOGE("light_set_state", "Invalid light_index %d for group 2", light_index); + ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8, + light_mode_group_2.c_str(), light_index); return; } if (state and !id(gb_lights_2)[light_index]->current_values.is_on()) { + ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8, + light_mode_group_2.c_str(), light_index); auto call = id(gb_lights_2)[light_index]->turn_on(); if (LIGHT_TRANSITION_TURN_ON > 0) call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms @@ -880,6 +890,8 @@ script: call.set_brightness(LIGHT_TRANSITION_TURN_ON / 100.0f); call.perform(); } else if (!state and id(gb_lights_2)[light_index]->current_values.is_on()) { + ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8, + light_mode_group_2.c_str(), light_index); auto call = id(gb_lights_2)[light_index]->turn_off(); if (LIGHT_TRANSITION_TURN_OFF > 0) call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml index 04aac9b..08c6490 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml @@ -208,7 +208,8 @@ tx_ultimate_easy: - script.execute: touch_on_multi_touch_release on_press: - - lambda: ESP_LOGI("tx_ultimate_easy", "Pressed"); + - lambda: |- + ESP_LOGI("tx_ultimate_easy", "Pressed at position %" PRIu8, static_cast(touch.x)); - script.execute: id: touch_on_press touch_x: !lambda return static_cast(touch.x);