upd: HW-buttons hold
This commit is contained in:
@@ -338,49 +338,116 @@ 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
|
||||||
condition:
|
max_length: 999ms
|
||||||
and:
|
then:
|
||||||
- switch.is_on: relay1_fallback
|
- binary_sensor.template.publish:
|
||||||
- not:
|
id: left_button_short
|
||||||
api.connected:
|
state: ON
|
||||||
then:
|
- delay: 500ms
|
||||||
- switch.toggle: relay_1
|
- binary_sensor.template.publish:
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=51");
|
id: left_button_short
|
||||||
- lambda: id(disp1).send_command_printf("home.left_bt_pic.pic=98");
|
state: OFF
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
switch.is_on: relay_1
|
and:
|
||||||
then:
|
- switch.is_on: relay1_fallback
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_01.pic=105");
|
- 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");
|
||||||
|
- 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
|
||||||
condition:
|
max_length: 999ms
|
||||||
and:
|
then:
|
||||||
- switch.is_on: relay2_fallback
|
- binary_sensor.template.publish:
|
||||||
- not:
|
id: right_button_short
|
||||||
api.connected:
|
state: ON
|
||||||
then:
|
- delay: 500ms
|
||||||
- switch.toggle: relay_2
|
- binary_sensor.template.publish:
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=51");
|
id: right_button_short
|
||||||
- lambda: id(disp1).send_command_printf("home.right_bt_pic.pic=98");
|
state: OFF
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
switch.is_on: relay_2
|
and:
|
||||||
then:
|
- switch.is_on: relay2_fallback
|
||||||
- lambda: id(disp1).send_command_printf("home.icon_top_02.pic=106");
|
- 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");
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|||||||
Reference in New Issue
Block a user