Fix relays chips

Fix relay status indication on chips.

Solves https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/926#issuecomment-1627660273
This commit is contained in:
Edward Firmo
2023-07-19 11:09:13 +02:00
parent 66e028f950
commit 2594df56ad
2 changed files with 31 additions and 14 deletions

View File

@@ -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