Physical relay local control
We are trying to make your panel as autonomous as possible by moving some of the controls from the Blueprint to ESPHome. This will reduce the load in your network and Home Assistant, but also will make a more reliable system capable to do it's core functionality even when the network is unavailable or Home Assistant is restarting. With this version, the following engines have been moved to your panel (local control): - Physical relay control (when hardware left button is connected to relay 1 or right button to relay 2) Solves #910
This commit is contained in:
@@ -520,6 +520,16 @@ api:
|
||||
id(mui_time_format) = time_format;
|
||||
- *refresh_datetime
|
||||
|
||||
##### Service for setting relays as locally controlled #####
|
||||
- service: set_relay_local
|
||||
variables:
|
||||
relay1: bool
|
||||
relay2: bool
|
||||
then:
|
||||
- lambda: |-
|
||||
id(relay1_local).publish_state(relay1);
|
||||
id(relay2_local).publish_state(relay2);
|
||||
|
||||
##### START - GLOBALS CONFIGURATION #####
|
||||
globals:
|
||||
|
||||
@@ -565,10 +575,12 @@ binary_sensor:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
and:
|
||||
- switch.is_on: relay1_fallback
|
||||
- not:
|
||||
api.connected:
|
||||
or:
|
||||
- switch.is_on: relay1_local
|
||||
- and:
|
||||
- switch.is_on: relay1_fallback
|
||||
- not:
|
||||
api.connected:
|
||||
then:
|
||||
- switch.toggle: relay_1
|
||||
- if:
|
||||
@@ -592,10 +604,12 @@ binary_sensor:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
and:
|
||||
- switch.is_on: relay2_fallback
|
||||
- not:
|
||||
api.connected:
|
||||
or:
|
||||
- switch.is_on: relay2_local
|
||||
- and:
|
||||
- switch.is_on: relay2_fallback
|
||||
- not:
|
||||
api.connected:
|
||||
then:
|
||||
- switch.toggle: relay_2
|
||||
- if:
|
||||
@@ -608,7 +622,6 @@ binary_sensor:
|
||||
- lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=77");
|
||||
- lambda: id(disp1).send_command_printf("home.icon_top_02","\U0000FFFF");
|
||||
|
||||
|
||||
##### Restart NSPanel Button - Setting Page #####
|
||||
- name: ${device_name} Restart
|
||||
platform: nextion
|
||||
@@ -893,6 +906,32 @@ switch:
|
||||
id: sleep_mode
|
||||
state: OFF
|
||||
|
||||
##### Relay Local control #####
|
||||
- name: ${device_name} Relay 1 Local
|
||||
platform: template
|
||||
id: relay1_local
|
||||
entity_category: config
|
||||
restore_state: true
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
internal: true
|
||||
on_turn_on:
|
||||
- logger.log: "Relay 1 Local turned On!"
|
||||
on_turn_off:
|
||||
- logger.log: "Relay 1 Local turned Off!"
|
||||
- name: ${device_name} Relay 2 Local
|
||||
platform: template
|
||||
id: relay2_local
|
||||
entity_category: config
|
||||
restore_state: true
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
internal: true
|
||||
on_turn_on:
|
||||
- logger.log: "Relay 2 Local turned On!"
|
||||
on_turn_off:
|
||||
- logger.log: "Relay 2 Local turned Off!"
|
||||
|
||||
##### Relay Local control Fallback #####
|
||||
- name: ${device_name} Relay 1 Local Fallback
|
||||
platform: template
|
||||
@@ -901,7 +940,6 @@ switch:
|
||||
restore_state: true
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
|
||||
- name: ${device_name} Relay 2 Local Fallback
|
||||
platform: template
|
||||
id: relay2_fallback
|
||||
|
||||
Reference in New Issue
Block a user