Merge pull request #282 from deejaybeam/dev

upd: HW-buttons hold
This commit is contained in:
Chris
2023-02-01 21:08:40 +01:00
committed by GitHub

View File

@@ -338,12 +338,23 @@ binary_sensor:
###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY##### ###### LEFT BUTTON BELOW DISPLAY TO TOGGLE RELAY#####
- platform: gpio - platform: gpio
name: ${device_name} Left Button # name: ${device_name} Left Button
id: left_button
pin: pin:
number: 14 number: 14
inverted: true inverted: true
on_click: on_click:
if: - min_length: 50ms
max_length: 999ms
then:
- binary_sensor.template.publish:
id: left_button_short
state: ON
- delay: 500ms
- binary_sensor.template.publish:
id: left_button_short
state: OFF
- if:
condition: condition:
and: and:
- switch.is_on: relay1_fallback - switch.is_on: relay1_fallback
@@ -358,15 +369,48 @@ binary_sensor:
switch.is_on: relay_1 switch.is_on: relay_1
then: then:
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105"); - lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105");
- min_length: 1000ms
max_length: 10000ms
then:
- binary_sensor.template.publish:
id: left_button_hold
state: ON
- delay: 500ms
- binary_sensor.template.publish:
id: left_button_hold
state: OFF
- platform: template
name: ${device_name} Left Button
id: left_button_short
lambda: |-
return {};
- platform: template
name: ${device_name} Left Button hold
id: left_button_hold
lambda: |-
return {};
##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY ##### ##### RIGHT BUTTON BELOW DISPLAY TO TOGGLE RELAY #####
- platform: gpio - platform: gpio
name: ${device_name} Right Button # name: ${device_name} Right Button
id: right_button
pin: pin:
number: 27 number: 27
inverted: true inverted: true
on_click: on_click:
if: - min_length: 50ms
max_length: 999ms
then:
- binary_sensor.template.publish:
id: right_button_short
state: ON
- delay: 500ms
- binary_sensor.template.publish:
id: right_button_short
state: OFF
- if:
condition: condition:
and: and:
- switch.is_on: relay2_fallback - switch.is_on: relay2_fallback
@@ -382,6 +426,29 @@ binary_sensor:
then: then:
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106"); - lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106");
- min_length: 1000ms
max_length: 10000ms
then:
- binary_sensor.template.publish:
id: right_button_hold
state: ON
- delay: 500ms
- binary_sensor.template.publish:
id: right_button_hold
state: OFF
- platform: template
name: ${device_name} Right Button
id: right_button_short
lambda: |-
return {};
- platform: template
name: ${device_name} Right Button hold
id: right_button_hold
lambda: |-
return {};
##### Restart NSPanel Button - Setting Page ##### ##### Restart NSPanel Button - Setting Page #####
- platform: nextion - platform: nextion
name: ${device_name} Restart name: ${device_name} Restart