hansen-hasst/packages/mailbox/switch.yaml
2024-04-24 21:58:21 +02:00

38 lines
959 B
YAML
Executable File

# Example configuration.yaml entry
switch:
- platform: template
switches:
mailbox:
turn_on:
service: switch.turn_on
target:
entity_id: switch.mailbox
turn_off:
service: switch.turn_off
target:
entity_id: switch.mailbox
icon_template: >
{% if is_state('switch.mailbox', 'on') %}
mdi:mailbox
{% else %}
mdi:mailbox-outline
{% endif %}
automation:
- alias: light_save_last_state
mode: single
trigger:
- platform: time_pattern
seconds: "10"
condition:
- condition: state
entity_id: light.office_bulb
state: "on"
action:
- service: scene.create
data:
snapshot_entities:
- light.office_bulb
- switch.adaptive_lighting_default
scene_id: last_on_state