From 2594df56ada581337405e6f9eda2696478970d97 Mon Sep 17 00:00:00 2001 From: Edward Firmo Date: Wed, 19 Jul 2023 11:09:13 +0200 Subject: [PATCH] Fix relays chips Fix relay status indication on chips. Solves https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/926#issuecomment-1627660273 --- nspanel_blueprint.yaml | 24 ++++++++++++------------ nspanel_esphome.yaml | 21 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index b67bfe8..8da3f9e 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -3933,12 +3933,12 @@ variables: unavailable: Unavailable no_name: No name alarm: - home: home - away: away - night: night - vacation: vacation - bypass: bypass - disarm: disarm + home: Zuhause + away: Abwesend + night: Nacht + vacation: Urlaub + bypass: Bypass + disarm: Deaktiviert el: #Greek weekdays: mon: Δευτέρα @@ -4893,12 +4893,12 @@ variables: unavailable: Unavailable no_name: No name alarm: - home: home - away: away - night: night - vacation: vacation - bypass: bypass - disarm: disarm + home: Thuis + away: Weg + night: Nacht + vacation: Vakantie + bypass: Omzeil + disarm: Ontgrendel pl: #Polish weekdays: mon: Poniedziałek diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index b63c448..38e4218 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -1097,6 +1097,15 @@ switch: pin: number: 22 restore_mode: RESTORE_DEFAULT_OFF + on_turn_on: + then: + - script.execute: + id: refresh_relays + on_turn_off: + then: + - script.execute: + id: refresh_relays + ##### PHYSICAL SWITCH 2 ###### - name: ${device_name} Relay 2 @@ -1105,6 +1114,14 @@ switch: pin: number: 19 restore_mode: RESTORE_DEFAULT_OFF + on_turn_on: + then: + - script.execute: + id: refresh_relays + on_turn_off: + then: + - script.execute: + id: refresh_relays ##### DISPLAY ALWAYS ON ##### - name: ${device_name} Screen Power @@ -1440,8 +1457,8 @@ script: if (id(relay_2).state) id(disp1).set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str()); else id(disp1).set_component_text_printf("home.icon_top_02", "\uFFFF"); // Hardware buttons - Fallback mode - if (id(relay_1).state or (id(relay1_fallback).state and not id(api_status).state)) id(disp1).send_command_printf("home.left_bt_pic.pic=%i", (id(relay_1).state) ? 78 : 77); - if (id(relay_2).state or (id(relay2_fallback).state and not id(api_status).state)) id(disp1).send_command_printf("home.right_bt_pic.pic=%i", (id(relay_2).state) ? 78 : 77); + if (id(relay_1).state and (id(relay1_local).state or (id(relay1_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.left_bt_pic.pic=%i", (id(relay_1).state) ? 78 : 77); + if (id(relay_2).state and (id(relay2_local).state or (id(relay2_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.right_bt_pic.pic=%i", (id(relay_2).state) ? 78 : 77); - id: refresh_chips_climate mode: restart