From e546fedf08386bc3a7c41fe10163a19eb3b13c6f Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 25 Dec 2024 02:11:10 +0100 Subject: [PATCH 1/3] Add dump config To help troubleshooting --- ...Ultimate-Easy-ESPHome_addon_ble_proxy.yaml | 6 ++ ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml | 56 +++++++++++++++++-- ...Ultimate-Easy-ESPHome_core_hw_buttons.yaml | 14 +++++ ...TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml | 45 +++++++++++++-- ...te-Easy-ESPHome_core_hw_media_player.yaml} | 0 ...-Ultimate-Easy-ESPHome_core_hw_relays.yaml | 34 +++++++++++ ...X-Ultimate-Easy-ESPHome_core_hw_touch.yaml | 9 +++ ...timate-Easy-ESPHome_core_hw_vibration.yaml | 13 ++++- 8 files changed, 164 insertions(+), 13 deletions(-) rename ESPHome/{TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml => TX-Ultimate-Easy-ESPHome_core_hw_media_player.yaml} (100%) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml index a18515c..743450c 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml @@ -96,6 +96,12 @@ rtttl: - id: rtttl_speaker speaker: mp_speaker +script: + - id: !extend dump_config + then: + - lambda: |- + ESP_LOGCONFIG("addon_ble_proxy", "Add-on BLE Proxy installed"); + speaker: - id: mp_speaker platform: i2s_audio diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml index a05fdb3..82707d4 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml @@ -25,14 +25,16 @@ substitutions: TX_MODEL_3_GANG_TEXT: "3 Gang" TX_MODEL_4_GANG_TEXT: "4 Gang" + DUMP_CONFIG_CALLER_DELAY: 10s # Delay to dump config after requested + packages: # yamllint disable rule:colons - core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml - core_hw_leds: !include TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml - core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml - core_hw_speaker: !include TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml - core_hw_touch: !include TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml - core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml + core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml + core_hw_leds: !include TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml + core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml + core_hw_media_player: !include TX-Ultimate-Easy-ESPHome_core_hw_media_player.yaml + core_hw_touch: !include TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml + core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml # yamllint enable rule:colons api: @@ -40,6 +42,7 @@ api: on_client_connected: then: - script.execute: publish_device_info + - script.execute: dump_config_caller binary_sensor: - id: bs_pending_restart @@ -49,6 +52,13 @@ binary_sensor: platform: template entity_category: diagnostic device_class: problem + on_state: + then: + - lambda: |- + if (x) + ESP_LOGW("core", "Pending restart: YES"); + else + ESP_LOGCONFIG("core", "Pending restart: No"); button: - id: bt_restart @@ -158,6 +168,40 @@ script: id: bs_pending_restart state: false + - id: dump_config + mode: restart + then: + # Extended by all modules + - lambda: |- + ESP_LOGCONFIG("core", "Device friendly name: ${friendly_name}"); + ESP_LOGCONFIG("core", "Device name: ${name}"); + ESP_LOGCONFIG("core", "Device name (HA): %s", tx_device_name->state.c_str()); + ESP_LOGCONFIG("core", "Device hostname: %s", App.get_name().c_str()); + ESP_LOGCONFIG("core", "ESPHome builder: %s", esphome_fw_version->state.c_str()); + ESP_LOGCONFIG("core", "TX Ultimate firmware version: ${version}"); + // Report framework + #ifdef ARDUINO + ESP_LOGCONFIG("core", "Framework: Arduino"); + #elif defined(USE_ESP_IDF) + ESP_LOGCONFIG("core", "Framework: ESP-IDF"); + #else + ESP_LOGW("core", "Framework: UNKNOWN"); + #endif + ESP_LOGCONFIG("core", "Model format (selected): %s", sl_tx_model_format->state.c_str()); + ESP_LOGCONFIG("core", "Model format (detected): %s", id(is_us_model) ? "US" : "EU"); + ESP_LOGCONFIG("core", "Gangs (selected): %s", sl_tx_model_gang->state.c_str()); + ESP_LOGCONFIG("core", "Gangs (detected): %" PRIu8 "-Gang%s", id(gang_count), id(gang_count) == 1 ? "" : "s"); + if (bs_pending_restart->state) + ESP_LOGW("core", "Pending restart: YES"); + else + ESP_LOGCONFIG("core", "Pending restart: No"); + + - id: dump_config_caller + mode: restart + then: + - delay: ${DUMP_CONFIG_CALLER_DELAY} + - script.execute: dump_config + - id: publish_device_info mode: restart then: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml index de16ddc..4c15f70 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml @@ -200,6 +200,20 @@ script: } } + - id: !extend dump_config + then: + - lambda: |- + ESP_LOGCONFIG("core_hw_buttons", "Button%s action%s:", + id(gang_count) == 1 ? "" : "s", + id(gang_count) == 1 ? "" : "s"); + ESP_LOGCONFIG("core_hw_buttons", " Relay 1: %s", sl_button_1_action->state.c_str()); + if (id(gang_count) >= 2) + ESP_LOGCONFIG("core_hw_buttons", " Relay 2: %s", sl_button_2_action->state.c_str()); + if (id(gang_count) >= 3) + ESP_LOGCONFIG("core_hw_buttons", " Relay 3: %s", sl_button_3_action->state.c_str()); + if (id(gang_count) >= 4) + ESP_LOGCONFIG("core_hw_buttons", " Relay 4: %s", sl_button_4_action->state.c_str()); + - id: !extend touch_on_multi_touch_release then: - script.execute: buttons_release diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml index b71944c..bb2ae57 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml @@ -481,8 +481,47 @@ script: light_eu_rl_3_4_top, light_eu_rl_4_4_top }; } break; + default: + ESP_LOGE("core_hw_leds", "Invalid gang count: %" PRIu8, id(gang_count)); + break; } + - id: !extend dump_config + then: + - lambda: |- + ESP_LOGCONFIG("core_hw_leds", "Relay%s LEDs mode%s:", + id(gang_count) == 1 ? "" : "s", + id(gang_count) == 1 ? "" : "s"); + ESP_LOGCONFIG("core_hw_leds", " Relay 1: %s", id(is_us_model) + ? sl_relay_1_light_mode_us->state.c_str() + : sl_relay_1_light_mode_eu->state.c_str()); + if (id(gang_count) >= 2) + ESP_LOGCONFIG("core_hw_leds", " Relay 2: %s", id(is_us_model) + ? sl_relay_2_light_mode_us->state.c_str() + : sl_relay_2_light_mode_eu->state.c_str()); + if (id(gang_count) >= 3) + ESP_LOGCONFIG("core_hw_leds", " Relay 3: %s", id(is_us_model) + ? sl_relay_3_light_mode_us->state.c_str() + : sl_relay_3_light_mode_eu->state.c_str()); + if (id(gang_count) >= 4) + ESP_LOGCONFIG("core_hw_leds", " Relay 4: %s", id(is_us_model) + ? sl_relay_4_light_mode_us->state.c_str() + : sl_relay_4_light_mode_eu->state.c_str()); + ESP_LOGCONFIG("core_hw_leds", "Transition time:"); + ESP_LOGCONFIG("core_hw_leds", " Default: ${default_transition_length}"); + if (${LIGHT_TRANSITION_TURN_ON} > 0) + ESP_LOGCONFIG("core_hw_leds", " Turning on: ${LIGHT_TRANSITION_TURN_ON}ms"); + else + ESP_LOGCONFIG("core_hw_leds", " Turning on: Disabled"); + if (${LIGHT_TRANSITION_TURN_OFF} > 0) + ESP_LOGCONFIG("core_hw_leds", " Turning off: ${LIGHT_TRANSITION_TURN_OFF}ms"); + else + ESP_LOGCONFIG("core_hw_leds", " Turning off: Disabled"); + ESP_LOGCONFIG("core_hw_leds", "LED restore modes:"); + ESP_LOGCONFIG("core_hw_leds", " Light - All: ${LIGHT_FULL_RESTORE_MODE}"); + ESP_LOGCONFIG("core_hw_leds", " Sides: ${LIGHT_SIDES_RESTORE_MODE}"); + ESP_LOGCONFIG("core_hw_leds", " Individual: ${LIGHT_INDIVIDUAL_RESTORE_MODE}"); + - id: light_set_state mode: parallel parameters: @@ -571,15 +610,12 @@ select: entity_category: config disabled_by_default: false icon: mdi:dots-square - - id: sl_relay_2_light_mode_eu name: Relay 2 light mode <<: *relay_light_mode_eu - - id: sl_relay_3_light_mode_eu name: Relay 3 light mode <<: *relay_light_mode_eu - - id: sl_relay_4_light_mode_eu name: Relay 4 light mode <<: *relay_light_mode_eu @@ -601,15 +637,12 @@ select: entity_category: config disabled_by_default: false icon: mdi:dots-square - - id: sl_relay_2_light_mode_us name: Relay 2 light mode <<: *relay_light_mode_us - - id: sl_relay_3_light_mode_us name: Relay 3 light mode <<: *relay_light_mode_us - - id: sl_relay_4_light_mode_us name: Relay 4 light mode <<: *relay_light_mode_us diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_media_player.yaml similarity index 100% rename from ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml rename to ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_media_player.yaml diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml index 5f47897..1aa82bb 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml @@ -634,6 +634,40 @@ script: ESP_LOGE("core_hw_relays", "No button action selected for button %" PRIu8, button); } + - id: !extend dump_config + then: + - lambda: |- + ESP_LOGCONFIG("core_hw_relays", "Relay%s mode%s:", + id(gang_count) == 1 ? "" : "s", + id(gang_count) == 1 ? "" : "s"); + ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sl_relay_1_mode->state.c_str()); + if (id(gang_count) >= 2) + ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sl_relay_2_mode->state.c_str()); + if (id(gang_count) >= 3) + ESP_LOGCONFIG("core_hw_relays", " Relay 3: %s", sl_relay_3_mode->state.c_str()); + if (id(gang_count) >= 4) + ESP_LOGCONFIG("core_hw_relays", " Relay 4: %s", sl_relay_4_mode->state.c_str()); + ESP_LOGCONFIG("core_hw_relays", "Relay%s state%s:", + id(gang_count) == 1 ? "" : "s", + id(gang_count) == 1 ? "" : "s"); + ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sw_relay_1->state ? "ON" : "OFF"); + if (id(gang_count) >= 2) + ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sw_relay_2->state ? "ON" : "OFF"); + if (id(gang_count) >= 3) + ESP_LOGCONFIG("core_hw_relays", " Relay 3: %s", sw_relay_3->state ? "ON" : "OFF"); + if (id(gang_count) >= 4) + ESP_LOGCONFIG("core_hw_relays", " Relay 4: %s", sw_relay_4->state ? "ON" : "OFF"); + ESP_LOGCONFIG("core_hw_relays", "Expose Relay's LEDs to Home Assistant: %s", + YESNO(sw_expose_relays_leds_to_ha->state)); + ESP_LOGCONFIG("core_hw_relays", "Boot initialization flags:"); + ESP_LOGCONFIG("core_hw_relays", " Overall: %s", YESNO(id(boot_initialization_relays))); + ESP_LOGCONFIG("core_hw_relays", " Light modes: %s", YESNO(id(boot_initialization_relays_light_modes))); + ESP_LOGCONFIG("core_hw_relays", " Relay modes: %s", YESNO(id(boot_initialization_relays_relay_modes))); + ESP_LOGCONFIG("core_hw_relays", " Status LEDs: %s", YESNO(id(boot_initialization_relays_relay_leds))); + ESP_LOGCONFIG("core_hw_relays", "Restore modes:"); + ESP_LOGCONFIG("core_hw_relays", " Relays: ${RELAY_RESTORE_MODE}"); + ESP_LOGCONFIG("core_hw_relays", " Status LEDs: ${LIGHT_RELAYS_RESTORE_MODE}"); + - id: show_relay_status mode: restart then: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml index 1d204c9..f840b9d 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml @@ -283,6 +283,15 @@ script: bs_button_3_long_press_event->set_internal(id(gang_count) < 3); bs_button_4_long_press_event->set_internal(id(gang_count) < 4); + - id: !extend dump_config + then: + - lambda: |- + if (sw_touch_panel_power->state) + ESP_LOGCONFIG("core_hw_touch", "Touch panel - Power: On"); + else + ESP_LOGW("core_hw_touch", "Touch panel - Power: OFF"); + ESP_LOGCONFIG("core_hw_touch", "Touch event duration: %.0fms", nr_touch_duration->state); + - id: touch_on_multi_touch_release mode: restart then: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml index 67655c1..09c8fc7 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml @@ -53,6 +53,18 @@ ota: - switch.turn_off: sw_vibration_motor script: + - id: !extend dump_config + then: + - lambda: |- + ESP_LOGCONFIG("core_hw_vibration", "Touch - Vibration feedback: %s", + sl_touch_vibration_feedback->state.c_str()); + ESP_LOGCONFIG("core_hw_vibration", "Vibrate duration: %.0fms", nr_vibrating_duration->state); + ESP_LOGCONFIG("core_hw_vibration", "Vibrate max duration: ${vibration_max_duration}"); + if (bs_vibrating->state) + ESP_LOGW("core_hw_vibration", "Vibrating now: YES"); + else + ESP_LOGCONFIG("core_hw_vibration", "Vibrating now: No"); + - id: !extend touch_on_multi_touch_release then: - script.execute: touch_on_multi_touch_release_vibration @@ -133,5 +145,4 @@ switch: - binary_sensor.template.publish: id: bs_vibrating state: OFF # yamllint disable-line rule:truthy - ... From 7aee88c38f7d91c2506d25eae66a3e619939ea65 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 25 Dec 2024 02:34:18 +0100 Subject: [PATCH 2/3] CodeRabbitAI suggestions --- ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml | 24 +++++++++++++++---- ...Ultimate-Easy-ESPHome_core_hw_buttons.yaml | 4 ++-- ...TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml | 11 ++++++--- ...-Ultimate-Easy-ESPHome_core_hw_relays.yaml | 8 +++---- ...timate-Easy-ESPHome_core_hw_vibration.yaml | 3 +++ 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml index 82707d4..32d9c55 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml @@ -31,8 +31,8 @@ packages: # yamllint disable rule:colons core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml core_hw_leds: !include TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml - core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml core_hw_media_player: !include TX-Ultimate-Easy-ESPHome_core_hw_media_player.yaml + core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml core_hw_touch: !include TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml # yamllint enable rule:colons @@ -41,8 +41,8 @@ api: id: api_server on_client_connected: then: - - script.execute: publish_device_info - script.execute: dump_config_caller + - script.execute: publish_device_info binary_sensor: - id: bs_pending_restart @@ -59,6 +59,7 @@ binary_sensor: ESP_LOGW("core", "Pending restart: YES"); else ESP_LOGCONFIG("core", "Pending restart: No"); + - script.execute: dump_config_caller button: - id: bt_restart @@ -105,6 +106,12 @@ globals: restore_value: true initial_value: '0' + - id: gang_count_plural_suffix + type: std::string + restore_value: true + max_restore_data_length: 3 + # initial_value: "''" + improv_serial: id: serial_improv @@ -159,6 +166,7 @@ script: if (id(gang_count) < 1 || id(gang_count) > 4) { ESP_LOGE("core_hw_leds", "Invalid number of gangs: %" PRIu8, id(gang_count)); } + id(gang_count_plural_suffix) = id(gang_count) > 1 ? "s" : ""; - id: boot_sequence mode: restart @@ -173,13 +181,17 @@ script: then: # Extended by all modules - lambda: |- + // Device identification ESP_LOGCONFIG("core", "Device friendly name: ${friendly_name}"); ESP_LOGCONFIG("core", "Device name: ${name}"); ESP_LOGCONFIG("core", "Device name (HA): %s", tx_device_name->state.c_str()); ESP_LOGCONFIG("core", "Device hostname: %s", App.get_name().c_str()); + + // Version information ESP_LOGCONFIG("core", "ESPHome builder: %s", esphome_fw_version->state.c_str()); ESP_LOGCONFIG("core", "TX Ultimate firmware version: ${version}"); - // Report framework + + // Framework detection #ifdef ARDUINO ESP_LOGCONFIG("core", "Framework: Arduino"); #elif defined(USE_ESP_IDF) @@ -187,10 +199,14 @@ script: #else ESP_LOGW("core", "Framework: UNKNOWN"); #endif + + // Model configuration ESP_LOGCONFIG("core", "Model format (selected): %s", sl_tx_model_format->state.c_str()); ESP_LOGCONFIG("core", "Model format (detected): %s", id(is_us_model) ? "US" : "EU"); ESP_LOGCONFIG("core", "Gangs (selected): %s", sl_tx_model_gang->state.c_str()); - ESP_LOGCONFIG("core", "Gangs (detected): %" PRIu8 "-Gang%s", id(gang_count), id(gang_count) == 1 ? "" : "s"); + ESP_LOGCONFIG("core", "Gangs (detected): %" PRIu8 "-Gang%s", id(gang_count), id(gang_count_plural_suffix).c_str()); + + // System state if (bs_pending_restart->state) ESP_LOGW("core", "Pending restart: YES"); else diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml index 4c15f70..7cb3039 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml @@ -204,8 +204,8 @@ script: then: - lambda: |- ESP_LOGCONFIG("core_hw_buttons", "Button%s action%s:", - id(gang_count) == 1 ? "" : "s", - id(gang_count) == 1 ? "" : "s"); + id(gang_count_plural_suffix).c_str(), + id(gang_count_plural_suffix).c_str()); ESP_LOGCONFIG("core_hw_buttons", " Relay 1: %s", sl_button_1_action->state.c_str()); if (id(gang_count) >= 2) ESP_LOGCONFIG("core_hw_buttons", " Relay 2: %s", sl_button_2_action->state.c_str()); diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml index bb2ae57..087ce46 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml @@ -489,9 +489,10 @@ script: - id: !extend dump_config then: - lambda: |- + // Relay's LEDs modes ESP_LOGCONFIG("core_hw_leds", "Relay%s LEDs mode%s:", - id(gang_count) == 1 ? "" : "s", - id(gang_count) == 1 ? "" : "s"); + id(gang_count_plural_suffix).c_str(), + id(gang_count_plural_suffix).c_str()); ESP_LOGCONFIG("core_hw_leds", " Relay 1: %s", id(is_us_model) ? sl_relay_1_light_mode_us->state.c_str() : sl_relay_1_light_mode_eu->state.c_str()); @@ -507,7 +508,9 @@ script: ESP_LOGCONFIG("core_hw_leds", " Relay 4: %s", id(is_us_model) ? sl_relay_4_light_mode_us->state.c_str() : sl_relay_4_light_mode_eu->state.c_str()); - ESP_LOGCONFIG("core_hw_leds", "Transition time:"); + + // Transition times + ESP_LOGCONFIG("core_hw_leds", "Transition times:"); ESP_LOGCONFIG("core_hw_leds", " Default: ${default_transition_length}"); if (${LIGHT_TRANSITION_TURN_ON} > 0) ESP_LOGCONFIG("core_hw_leds", " Turning on: ${LIGHT_TRANSITION_TURN_ON}ms"); @@ -517,6 +520,8 @@ script: ESP_LOGCONFIG("core_hw_leds", " Turning off: ${LIGHT_TRANSITION_TURN_OFF}ms"); else ESP_LOGCONFIG("core_hw_leds", " Turning off: Disabled"); + + // Restore modes ESP_LOGCONFIG("core_hw_leds", "LED restore modes:"); ESP_LOGCONFIG("core_hw_leds", " Light - All: ${LIGHT_FULL_RESTORE_MODE}"); ESP_LOGCONFIG("core_hw_leds", " Sides: ${LIGHT_SIDES_RESTORE_MODE}"); diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml index 1aa82bb..f58e374 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml @@ -638,8 +638,8 @@ script: then: - lambda: |- ESP_LOGCONFIG("core_hw_relays", "Relay%s mode%s:", - id(gang_count) == 1 ? "" : "s", - id(gang_count) == 1 ? "" : "s"); + id(gang_count_plural_suffix).c_str(), + id(gang_count_plural_suffix).c_str()); ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sl_relay_1_mode->state.c_str()); if (id(gang_count) >= 2) ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sl_relay_2_mode->state.c_str()); @@ -648,8 +648,8 @@ script: if (id(gang_count) >= 4) ESP_LOGCONFIG("core_hw_relays", " Relay 4: %s", sl_relay_4_mode->state.c_str()); ESP_LOGCONFIG("core_hw_relays", "Relay%s state%s:", - id(gang_count) == 1 ? "" : "s", - id(gang_count) == 1 ? "" : "s"); + id(gang_count_plural_suffix).c_str(), + id(gang_count_plural_suffix).c_str()); ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sw_relay_1->state ? "ON" : "OFF"); if (id(gang_count) >= 2) ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sw_relay_2->state ? "ON" : "OFF"); diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml index 09c8fc7..fd19fb9 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml @@ -56,10 +56,13 @@ script: - id: !extend dump_config then: - lambda: |- + // Configuration ESP_LOGCONFIG("core_hw_vibration", "Touch - Vibration feedback: %s", sl_touch_vibration_feedback->state.c_str()); ESP_LOGCONFIG("core_hw_vibration", "Vibrate duration: %.0fms", nr_vibrating_duration->state); ESP_LOGCONFIG("core_hw_vibration", "Vibrate max duration: ${vibration_max_duration}"); + + // State if (bs_vibrating->state) ESP_LOGW("core_hw_vibration", "Vibrating now: YES"); else From 5ddf5388bd41d1efa3c39f02ab5c43350b114408 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 25 Dec 2024 03:00:56 +0100 Subject: [PATCH 3/3] Handle unknown states --- ...TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml | 16 ++++++++++++---- .../TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml index 7cb3039..43c8717 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml @@ -206,13 +206,21 @@ script: ESP_LOGCONFIG("core_hw_buttons", "Button%s action%s:", id(gang_count_plural_suffix).c_str(), id(gang_count_plural_suffix).c_str()); - ESP_LOGCONFIG("core_hw_buttons", " Relay 1: %s", sl_button_1_action->state.c_str()); + ESP_LOGCONFIG("core_hw_buttons", " Relay 1: %s", sl_button_1_action->has_state() + ? sl_button_1_action->state.c_str() + : "Unknown"); if (id(gang_count) >= 2) - ESP_LOGCONFIG("core_hw_buttons", " Relay 2: %s", sl_button_2_action->state.c_str()); + ESP_LOGCONFIG("core_hw_buttons", " Relay 2: %s", sl_button_2_action->has_state() + ? sl_button_2_action->state.c_str() + : "Unknown"); if (id(gang_count) >= 3) - ESP_LOGCONFIG("core_hw_buttons", " Relay 3: %s", sl_button_3_action->state.c_str()); + ESP_LOGCONFIG("core_hw_buttons", " Relay 3: %s", sl_button_3_action->has_state() + ? sl_button_3_action->state.c_str() + : "Unknown"); if (id(gang_count) >= 4) - ESP_LOGCONFIG("core_hw_buttons", " Relay 4: %s", sl_button_4_action->state.c_str()); + ESP_LOGCONFIG("core_hw_buttons", " Relay 4: %s", sl_button_4_action->has_state() + ? sl_button_4_action->state.c_str() + : "Unknown"); - id: !extend touch_on_multi_touch_release then: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml index f58e374..ee1c16e 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml @@ -640,13 +640,21 @@ script: ESP_LOGCONFIG("core_hw_relays", "Relay%s mode%s:", id(gang_count_plural_suffix).c_str(), id(gang_count_plural_suffix).c_str()); - ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sl_relay_1_mode->state.c_str()); + ESP_LOGCONFIG("core_hw_relays", " Relay 1: %s", sl_relay_1_mode->has_state() + ? sl_relay_1_mode->state.c_str() + : "Unknown"); if (id(gang_count) >= 2) - ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sl_relay_2_mode->state.c_str()); + ESP_LOGCONFIG("core_hw_relays", " Relay 2: %s", sl_relay_2_mode->has_state() + ? sl_relay_2_mode->state.c_str() + : "Unknown"); if (id(gang_count) >= 3) - ESP_LOGCONFIG("core_hw_relays", " Relay 3: %s", sl_relay_3_mode->state.c_str()); + ESP_LOGCONFIG("core_hw_relays", " Relay 3: %s", sl_relay_3_mode->has_state() + ? sl_relay_3_mode->state.c_str() + : "Unknown"); if (id(gang_count) >= 4) - ESP_LOGCONFIG("core_hw_relays", " Relay 4: %s", sl_relay_4_mode->state.c_str()); + ESP_LOGCONFIG("core_hw_relays", " Relay 4: %s", sl_relay_4_mode->has_state() + ? sl_relay_4_mode->state.c_str() + : "Unknown"); ESP_LOGCONFIG("core_hw_relays", "Relay%s state%s:", id(gang_count_plural_suffix).c_str(), id(gang_count_plural_suffix).c_str());