Created
February 11, 2022 23:01
-
-
Save B4dM4n/aa1bde301f49a7a79bdb5da8d311387e to your computer and use it in GitHub Desktop.
Home Assistant automation blueprint to perform actions when a device starts and stops as detected by a power sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Appliance power events | |
description: Do something when an appliance (like a washing machine or dishwasher) has started or finished as detected by a power sensor. | |
domain: automation | |
source_url: https://gist.github.com/B4dM4n/aa1bde301f49a7a79bdb5da8d311387e | |
input: | |
power_sensor: | |
name: Power Sensor | |
description: Power sensor entity (e.g. from a smart plug device). | |
selector: | |
entity: | |
domain: sensor | |
starting_threshold: | |
name: Starting power threshold | |
description: Power threshold above which we assume the appliance has started. | |
default: 10 | |
selector: | |
number: | |
min: 1 | |
max: 1000 | |
unit_of_measurement: W | |
mode: slider | |
step: 1 | |
starting_hysteresis: | |
name: Starting hysteresis | |
description: Time duration the power measurement has to stay above the starting power threshold. | |
default: 30 | |
selector: | |
number: | |
min: 1 | |
max: 600 | |
unit_of_measurement: sec | |
mode: slider | |
step: 15 | |
finishing_threshold: | |
name: Finishing power threshold | |
description: Power threshold below which we assume the appliance has finished. | |
default: 10 | |
selector: | |
number: | |
min: 1 | |
max: 1000 | |
unit_of_measurement: W | |
mode: slider | |
step: 1 | |
finishing_hysteresis: | |
name: Finishing hysteresis | |
description: Time duration the power measurement has to stay below the finishing power threshold. | |
default: 30 | |
selector: | |
number: | |
min: 1 | |
max: 600 | |
unit_of_measurement: sec | |
mode: slider | |
step: 15 | |
start_actions: | |
name: Start Actions | |
description: Actions to run when the appliance has started | |
selector: | |
action: {} | |
stop_actions: | |
name: Stop Actions | |
description: Actions to run when the appliance has stopped | |
selector: | |
action: {} | |
trigger: | |
- platform: numeric_state | |
entity_id: !input "power_sensor" | |
for: | |
seconds: !input "starting_hysteresis" | |
above: !input "starting_threshold" | |
condition: [] | |
action: | |
- choose: [] | |
default: !input "start_actions" | |
- wait_for_trigger: | |
- platform: numeric_state | |
entity_id: !input "power_sensor" | |
below: !input "finishing_threshold" | |
for: | |
seconds: !input "finishing_hysteresis" | |
- choose: [] | |
default: !input "stop_actions" | |
mode: single | |
max_exceeded: silent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment