94 lines
2.6 KiB
YAML
94 lines
2.6 KiB
YAML
blueprint:
|
|
name: Occupancy Socket Control with Power Alert
|
|
description: Turns off sockets when everyone leaves home and turns them back on when someone returns. Sends an alert if an appliance was actively drawing power when the home became empty.
|
|
domain: automation
|
|
input:
|
|
home_zone:
|
|
name: Home Zone
|
|
description: The zone representing your home.
|
|
selector:
|
|
entity:
|
|
domain: zone
|
|
default: zone.home
|
|
target_switches:
|
|
name: Sockets / Switches
|
|
description: The smart plugs to turn off when empty and turn on when occupied.
|
|
selector:
|
|
target:
|
|
entity:
|
|
domain: switch
|
|
power_sensor:
|
|
name: Power Metering Sensor
|
|
description: The power sensor (Watts) to monitor for active consumption.
|
|
selector:
|
|
entity:
|
|
domain: sensor
|
|
device_class: power
|
|
power_threshold:
|
|
name: Power Threshold (Watts)
|
|
description: Minimum wattage to trigger the alert (ignores standby power).
|
|
selector:
|
|
number:
|
|
min: 0.1
|
|
max: 100.0
|
|
step: 0.1
|
|
unit_of_measurement: W
|
|
default: 1.0
|
|
notify_device:
|
|
name: Notification Action
|
|
description: The notification service to alert you when an active appliance is turned off.
|
|
selector:
|
|
action: {}
|
|
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: zone
|
|
entity_id: !input home_zone
|
|
event: leave
|
|
zone: !input home_zone
|
|
id: home_emptied
|
|
- platform: zone
|
|
entity_id: !input home_zone
|
|
event: enter
|
|
zone: !input home_zone
|
|
id: someone_returned
|
|
|
|
condition: []
|
|
|
|
action:
|
|
- choose:
|
|
# ACTION 1: EVERYONE LEAVES HOME
|
|
- conditions:
|
|
- condition: trigger
|
|
id: home_emptied
|
|
- condition: numeric_state
|
|
entity_id: !input home_zone
|
|
below: 1
|
|
sequence:
|
|
# Check power consumption before killing the switch
|
|
- if:
|
|
- condition: numeric_state
|
|
entity_id: !input power_sensor
|
|
above: !input power_threshold
|
|
then:
|
|
- choose: []
|
|
default: !input notify_device
|
|
|
|
# Turn off the target sockets
|
|
- action: switch.turn_off
|
|
target: !input target_switches
|
|
|
|
# ACTION 2: SOMEONE RETURNS HOME
|
|
- conditions:
|
|
- condition: trigger
|
|
id: someone_returned
|
|
- condition: numeric_state
|
|
entity_id: !input home_zone
|
|
above: 0
|
|
sequence:
|
|
# Turn back on the target sockets
|
|
- action: switch.turn_on
|
|
target: !input target_switches
|
|
|