diff options
-rw-r--r-- | kauf-plug.yaml | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/kauf-plug.yaml b/kauf-plug.yaml index bab9eac..ff86563 100644 --- a/kauf-plug.yaml +++ b/kauf-plug.yaml @@ -15,7 +15,7 @@ substitutions: # https://esphome.io/components/esphome.html#esphome-creators-project project_name: Kauf.PLF10 - project_ver_num: "1.92" + project_ver_num: "1.93" project_ver_let: y # https://esphome.io/components/switch/gpio.html?highlight=restore_mode @@ -24,18 +24,25 @@ substitutions: disable_entities: "true" # set to "false" to have all entities show up in Home Assistant automatically - # substitutions for button actions. yaml dashboard import uses press, but update bin file uses hold_short to allow hold_long - # to turn on wifi ap. These substitutions can be overwritten in the user's yaml file to do anything. + # substitutions for button actions. on_press and on_release implement a timer scheme with configurable delay. + # on_hold_5s re-enables the AP and captive portal for the precompiled update binary. + # any length of hold can be implemented with just on_press and on_release using the following directions. This + # is basically how this yaml file works. + # * have a delay for the desired hold in the on_press script + # * stop the on_press script in the on_release script + # * place actions in the on_press script after the delay to perform them while still holding the button + # * place actions in the on_release script, with the condition that the on_press script is not running, to + # perform them on release of the button. sub_on_press: script_start_timer # executes right when button is initially pressed sub_on_release: script_stop_timer # executes right when button is released + sub_on_hold_5s: script_do_nothing # executes right when button has been held for 5s, while button is still being held sub_on_release_quick: script_do_nothing # executes when button is released after being held under 750ms sub_on_release_short: script_do_nothing # executes when button is released after being held between 750ms and 5s sub_on_release_long: script_do_nothing # executes when button is released after being held between 5s and 60s - # For a longer hold, see kauf-plug-update.yaml in the config-update directory. - # You have to start a timer in the on_press script and cancel the timer in the on_release script. - # or if you wanted to require release, then start a counter on press and check the value on release. - # If you want to have a hold action, you probably want to toggle on release_quick instead of on_press so that - # you can perform the hold action without toggling the plug's relay. + + # an extra script that, if running, will stop the relay from toggling on button release. + # used to not toggle when WiFi AP is re-enabled on update bin file. + sub_toggle_check: script_start_timer # substitutions for power monitoring calibration. Allows end users to change calibration in their yaml and still @@ -62,10 +69,6 @@ substitutions: sub_update_interval: 10s sub_initial_mode: CURRENT - # an extra script that, if running, will stop the relay from toggling on button release. - # used to not toggle when WiFi AP is re-enabled on update bin file. - sub_toggle_check: script_start_timer - # https://esphome.io/components/esp8266.html esp8266: @@ -321,6 +324,8 @@ script: - id: script_start_timer then: + - script.execute: script_5s_timer + # variable delay before toggling plug - delay: !lambda |- if ( id(select_button).state == "Toggle if Pressed For 20ms" ) @@ -349,7 +354,7 @@ script: - id: script_stop_timer then: - + - if: condition: # potentially toggle if a "released" option is selected lambda: |- @@ -367,9 +372,16 @@ script: else: # otherwise toggle relay - switch.toggle: relay - # in all cases, stop timer on button release. + # in all cases, stop timers on button release. + - script.stop: script_5s_timer - script.stop: script_start_timer + + - id: script_5s_timer + then: + - delay: 5s + - script.execute: $sub_on_hold_5s + - id: script_do_nothing then: - lambda: return; @@ -682,7 +694,7 @@ select: global_addr: global_forced_addr - platform: template - name: $friendly_name Blue LED + name: $friendly_name Blue LED Config id: select_bled optimistic: true entity_category: config @@ -710,7 +722,7 @@ select: - script.execute: script_set_power_leds - platform: template - name: $friendly_name Red LED + name: $friendly_name Red LED Config id: select_rled optimistic: true entity_category: config |