diff options
author | Kaufman Home Automation <[email protected]> | 2022-05-10 11:00:34 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-10 11:00:34 -0700 |
commit | e595f7b6b1169f0777e769f5656b313a5d905e95 (patch) | |
tree | c035b87374ebf0ece03e54903d0abc14b1117ddf | |
parent | e578cc17ed78e5a266ad2328f179b9eda18eea3f (diff) | |
download | PLF10-e595f7b6b1169f0777e769f5656b313a5d905e95.tar.gz PLF10-e595f7b6b1169f0777e769f5656b313a5d905e95.zip |
v1.94v1.94
adds button press duration sensor
-rw-r--r-- | kauf-plug.yaml | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kauf-plug.yaml b/kauf-plug.yaml index ff86563..4150209 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.93" + project_ver_num: "1.94" project_ver_let: y # https://esphome.io/components/switch/gpio.html?highlight=restore_mode @@ -84,6 +84,10 @@ globals: type: int restore_value: no initial_value: '12345' + - id: global_press_time + type: int + restore_value: no + initial_value: '0' # https://esphome.io/components/esphome.html#adjusting-flash-writes @@ -324,6 +328,9 @@ script: - id: script_start_timer then: + # store press time in ms + - lambda: id(global_press_time) = millis(); + - script.execute: script_5s_timer # variable delay before toggling plug @@ -355,6 +362,9 @@ script: - id: script_stop_timer then: + # set duration sensor + - lambda: id(sensor_press_duration).publish_state(millis() - id(global_press_time)); + - if: condition: # potentially toggle if a "released" option is selected lambda: |- @@ -575,6 +585,14 @@ sensor: # Power monitoring sensors output to Home Assistant entity_category: diagnostic disabled_by_default: $disable_entities + - platform: template + name: $friendly_name Button Press Duration + id: sensor_press_duration + entity_category: diagnostic + disabled_by_default: $disable_entities + unit_of_measurement: ms + icon: mdi:timer-outline + # https://esphome.io/components/number/index.html # https://esphome.io/components/number/template.html |