78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
blueprint:
|
|
name: Simulated Presence - Random Lights
|
|
description: >
|
|
Randomly toggles lights when a thermostat attribute equals a specified value
|
|
and it's nighttime (sun below horizon).
|
|
domain: automation
|
|
input:
|
|
lights:
|
|
name: Light Entities
|
|
description: Select the lights to simulate presence
|
|
selector:
|
|
entity:
|
|
domain: light
|
|
multiple: true
|
|
|
|
thermostat:
|
|
name: Thermostat Entity
|
|
description: The climate entity to check for the specified attribute
|
|
selector:
|
|
entity:
|
|
domain: climate
|
|
|
|
attribute_name:
|
|
name: Thermostat Attribute
|
|
description: Attribute of the thermostat to check (e.g., preset_mode)
|
|
default: preset_mode
|
|
selector:
|
|
text:
|
|
|
|
expected_value:
|
|
name: Expected Attribute Value
|
|
description: The value that triggers this automation (e.g., away_indefinitely)
|
|
default: away_indefinitely
|
|
selector:
|
|
text:
|
|
|
|
interval:
|
|
name: Randomization Interval (minutes)
|
|
description: How often to randomly toggle lights
|
|
default: 10
|
|
selector:
|
|
number:
|
|
min: 1
|
|
max: 60
|
|
unit_of_measurement: minutes
|
|
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sun.sun
|
|
to: "below_horizon"
|
|
|
|
condition:
|
|
- condition: template
|
|
value_template: >
|
|
{{ state_attr(thermostat, attribute_name) == expected_value }}
|
|
|
|
action:
|
|
- repeat:
|
|
while:
|
|
- condition: state
|
|
entity_id: sun.sun
|
|
state: "below_horizon"
|
|
- condition: template
|
|
value_template: >
|
|
{{ state_attr(thermostat, attribute_name) == expected_value }}
|
|
sequence:
|
|
- variables:
|
|
selected_lights: "{{ lights | random }}"
|
|
- service: >
|
|
{{ ['light.turn_on', 'light.turn_off'] | random }}
|
|
target:
|
|
entity_id: "{{ selected_lights }}"
|
|
- delay:
|
|
minutes: !input interval
|
|
|