@@ -15,7 +15,7 @@ substitutions:
15
15
16
16
# https://esphome.io/components/esphome.html#esphome-creators-project
17
17
project_name : Kauf.RGBSw
18
- project_ver_num : " 1.321 "
18
+ project_ver_num : " 1.322 "
19
19
project_ver_let : y
20
20
21
21
disable_entities : " true" # set to "false" to have all entities show up in Home Assistant automatically
@@ -27,11 +27,12 @@ substitutions:
27
27
# when these substitutions are redefined. Redefining these will not stop the ui switch from toggling.
28
28
# The button configuration select entity must be set to disabled to stop the button from toggling the ui switch.
29
29
# The button press duration sensor will also still update even with these redefined.
30
- sub_on_press : script_do_nothing # executes right when button is pressed
31
- sub_on_release : script_do_nothing # executes right when button is released
32
- sub_on_double_press : script_do_nothing # executes when the button is double pressed
33
- sub_on_single_press : script_do_nothing # executes when the button is single pressed only, not held or double pressed
34
- sub_on_hold : script_do_nothing # executes when the button is held for a threshold amount of time
30
+ sub_on_press : script_do_nothing # executes right when button is pressed
31
+ sub_on_release : script_do_nothing # executes right when button is released
32
+ sub_on_double_press : script_do_nothing # executes when the button is double pressed
33
+ sub_on_single_press : script_do_nothing # executes when the button is single pressed only, not held or double pressed
34
+ sub_on_hold : script_do_nothing # executes when the button is held for a threshold amount of time
35
+ sub_on_release_without_hold : script_do_nothing # executes when the button is released after a press that is under the hold threshold.
35
36
36
37
# an extra script that, if running, will stop the switch from toggling on button release.
37
38
sub_toggle_check : script_do_nothing
@@ -54,12 +55,15 @@ substitutions:
54
55
sub_hold_time : 750ms
55
56
sub_button_sensor_duration : 500ms
56
57
57
- # substitutions to sync hass entities to and from the switch
58
- hass_entity_single_press_toggle : no.ne
59
- hass_entity_double_press_toggle : no.ne
60
- hass_entity_hold_toggle : no.ne
61
- hass_entity_control_small_light : no.ne
62
- hass_entity_control_big_light : no.ne
58
+ # substitutions to control hass entities with press combos
59
+ hass_entity_single_press_toggle : no.ne
60
+ hass_entity_double_press_toggle : no.ne
61
+ hass_entity_hold_toggle : no.ne
62
+ hass_entity_release_without_hold_toggle : no.ne
63
+
64
+ # substitutions to sync lights with hass entities instead of UI switch
65
+ hass_entity_control_small_light : no.ne
66
+ hass_entity_control_big_light : no.ne
63
67
64
68
65
69
# https://esphome.io/components/esp8266.html
@@ -100,6 +104,9 @@ esphome:
100
104
- binary_sensor.template.publish :
101
105
id : button_hold
102
106
state : OFF
107
+ - binary_sensor.template.publish :
108
+ id : button_release_without_hold
109
+ state : OFF
103
110
104
111
105
112
# https://esphome.io/components/external_components.html
@@ -237,6 +244,18 @@ binary_sensor:
237
244
id(script_hass_toggle_hold).execute();
238
245
id($sub_on_hold).execute();
239
246
247
+ # definition for release without hold
248
+ - timing :
249
+ - ON for at most $sub_hold_time
250
+ then :
251
+ - lambda : |-
252
+ id(button_release_without_hold).publish_state(true);
253
+ // toggle if button is configured to toggle on release without hold
254
+ if (id(select_button).state == "Toggle on Release Without Hold") {
255
+ id(ui_switch).toggle(); }
256
+ id(script_hass_toggle_release_without_hold).execute();
257
+ id($sub_on_release_without_hold).execute();
258
+
240
259
- platform : template
241
260
name : $friendly_name Single Press
242
261
id : button_single_press
@@ -265,6 +284,14 @@ binary_sensor:
265
284
id : button_hold
266
285
state : OFF
267
286
287
+ - platform : template
288
+ name : $friendly_name Release Without Hold
289
+ id : button_release_without_hold
290
+ on_press :
291
+ - delay : $sub_button_sensor_duration
292
+ - binary_sensor.template.publish :
293
+ id : button_release_without_hold
294
+ state : OFF
268
295
269
296
# https://esphome.io/components/switch/index.html
270
297
switch :
@@ -520,6 +547,7 @@ select:
520
547
- Toggle on Single Press
521
548
- Toggle on Double Press
522
549
- Toggle on Hold
550
+ - Toggle on Release Without Hold
523
551
restore_value : true
524
552
entity_category : config
525
553
icon : mdi:toggle-switch-off-outline
@@ -656,6 +684,16 @@ script:
656
684
data :
657
685
entity_id : $hass_entity_hold_toggle
658
686
687
+ - id : script_hass_toggle_release_without_hold
688
+ then :
689
+ if :
690
+ condition : # toggle if release without hold hass entity is set
691
+ lambda : return (strcmp("$hass_entity_release_without_hold_toggle","no.ne") != 0 );
692
+ then :
693
+ homeassistant.service :
694
+ service : homeassistant.toggle
695
+ data :
696
+ entity_id : $hass_entity_release_without_hold_toggle
659
697
660
698
# https://esphome.io/components/button/index.html
661
699
button :
0 commit comments