I currently have a switch (integration: Tuya) and 2 lamps connected in a group (integration: ZHA). Plus simple automation:
trigger:
- platform: device
type: changed_states
device_id: a72ccdeec00700acbf1ccd34d271daf6
entity_id: d62f8856751f080ecf8b897205ffdfac
domain: switch
- platform: state
entity_id:
- light.salon
condition:
- condition: template
value_template: "{{ states('light.salon') != states('switch.wlacznik_salon_salon') }}"
action:
- if:
- condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
then:
- service: light.turn_on
metadata: {}
data:
kelvin: 2500
brightness_pct: 50
target:
entity_id:
- light.salon
- type: turn_on
device_id: a72ccdeec00700acbf1ccd34d271daf6
entity_id: d62f8856751f080ecf8b897205ffdfac
domain: switch
else:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.salon
- type: turn_off
device_id: a72ccdeec00700acbf1ccd34d271daf6
entity_id: d62f8856751f080ecf8b897205ffdfac
domain: switch
mode: single
Is there a simpler way to BIND one with the other?
The current solution has the disadvantage that if I use the switch, the automation turns on the light, and this triggers the automation again.
On the other hand, if I remove light.salon
from the triggers, the light control will not switch switch
to proper state.