Home Assistant Blueprint: Sonoff Detached Lights

sonoff_detached_lights.yml

blueprint:
name: Sonoff Detached Lights
description: >
Keep a light synchronized with the state of a detached Sonoff switch.
domain: automation
author: Rui
input:
switch_entity:
name: Detached switch
selector:
entity:
filter:
- domain: switch
light_target:
name: Corresponding light
selector:
target:
entity:
- domain: light
triggers:
- trigger: state
entity_id: !input switch_entity
from: "off"
to: "on"
- trigger: state
entity_id: !input switch_entity
from: "on"
to: "off"
actions:
- action: >-
{% if trigger.to_state.state == "on" %}
light.turn_on
{% else %}
light.turn_off
{% endif %}
target: !input light_target
mode: restart
添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论