Files
sarah/config/packages/devices/bedroom/tapo.yaml
T
2022-12-01 16:01:59 +02:00

47 lines
1.2 KiB
YAML

switch:
- platform: template
switches:
tapo_bedroom:
friendly_name: "Bedroom Camera"
value_template: "{{ is_state('switch.bedroom_privacy', 'off') }}"
turn_on:
service: script.tapo_bedroom_on
turn_off:
service: script.tapo_bedroom_off
icon_template: >
{%if is_state('switch.bedroom_privacy', 'off') %}
mdi:video
{% else %}
mdi:video-off
{% endif %}
script:
tapo_bedroom_toggle:
sequence:
- choose:
- conditions: "{{ is_state('switch.bedroom_privacy', 'on') }}"
sequence:
- service: script.tapo_bedroom_off
default:
- service: script.tapo_bedroom_on
tapo_bedroom_on:
sequence:
- service: switch.turn_off
entity_id: switch.bedroom_privacy
- service: select.select_option
entity_id: select.bedroom_move_to_preset
data:
option: away
tapo_bedroom_off:
sequence:
- service: select.select_option
entity_id: select.bedroom_move_to_preset
data:
option: home
- service: switch.turn_on
entity_id: switch.bedroom_privacy