三控是不是这样的:
- alias: switch sync
initial_state: false
trigger:
platform: state
entity_id: switch.xxx, switch.yyy, switch.zzz
action:
service_template: "switch.turn_{{ 'on' if trigger.to_state.state == 'on' else 'off' }}"
data_template:
entity_id: "switch.{{ 'yyy' if trigger.entity_id == 'switch.xxx' else 'xxx' }}" data_template:
entity_id: >
{% if trigger.entity_id == 'switch.xxx' %}
switch.yyy
switch.zzz
{% else %}
{% if trigger.entity_id == 'switch.yyy' %}
switch.xxx
switch.zzz
{% else %}
switch.xxx
switch.yyy
{% endif %}
|