diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index d79ca09..38ba39a 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -341,6 +341,22 @@ binary_sensor: pin: number: 14 inverted: true + on_click: + if: + condition: + and: + - switch.is_on: relay1_fallback + - not: + api.connected: + then: + - switch.toggle: relay_1 + - lambda: id(disp1).send_command_printf("home.icon_top_01.pic=51"); + - lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=98"); + - if: + condition: + switch.is_on: relay_1 + then: + - lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105"); ##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY ##### - platform: gpio @@ -348,6 +364,22 @@ binary_sensor: pin: number: 27 inverted: true + on_click: + if: + condition: + and: + - switch.is_on: relay2_fallback + - not: + api.connected: + then: + - switch.toggle: relay_2 + - lambda: id(disp1).send_command_printf("home.icon_top_02.pic=51"); + - lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=98"); + - if: + condition: + switch.is_on: relay_2 + then: + - lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106"); ##### Restart NSPanel Button - Setting Page ##### - platform: nextion @@ -718,6 +750,20 @@ switch: value: '1' - lambda: id(disp1).set_component_value("settings.a02",1); + ##### Relay Local control Fallback ##### + - platform: template + name: ${device_name} Relay 1 Local Fallback + id: relay1_fallback + entity_category: config + restore_state: true + optimistic: true + + - platform: template + name: ${device_name} Relay 2 Local Fallback + id: relay2_fallback + entity_category: config + restore_state: true + optimistic: true ##### START - NUMBER CONFIGURATION ##### number: