Hello to everybody,
I need help, I reached the step where I can turn on all 6 switches with one automation and turn them off with the other automation,
but it only works in the ideal case.
If I quickly turn one of the switches on and off, all the switches start flashing frantically - the automations start to mix.
Before starting the automation, I need to set the condition that another automation (OFF) is terminated.
Thank you
alias: Hall_First_Floor_Light_Grp_Test
description: ""
trigger:
- platform: device
type: turned_on
device_id: 81af6d31b118bd546478c3a58e36f8c0
entity_id: switch.laundry_room_center
domain: switch
- platform: device
type: turned_on
device_id: d6cf0308cba34106d6a0e438a474f2e8
entity_id: switch.bathroom_l2
domain: switch
- platform: device
type: turned_on
device_id: ccb67b715cec3458fe56126dcc778b97
entity_id: switch.0x00124b00226afe36_center
domain: switch
- platform: device
type: turned_on
device_id: ff914d6c12df3224546be0ea5e696086
entity_id: switch.0x00124b00226bba0e_left
domain: switch
- platform: device
type: turned_on
device_id: de03749fcb3f4913e82ef056c92a86ab
entity_id: switch.childen_room_mirda_center
domain: switch
- platform: device
type: turned_on
device_id: 1af32bce1232d5b7c24d5992efe294d9
entity_id: switch.children_room_tea_center
domain: switch
condition: []
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.hallway_first_floor_light_grp
mode: single
Hello, I’m sorry.
I think it applies to HA.
I just need advice on how to improve my automation so that everything works perfectly.
Thank you
Can you explain what you want the automation to do? Do you want the “group switch” to turn on and off when you operate any of six separate switches? If so, this should do it, assuming the “group switch” doesn’t then change the state of the others:
alias: Switch manager
id: 252e7b80-9fad-4287-b397-c117f0d6447b
description: >
When any of the six switches changes, set the group switch
to match the state of the switch that has just been operated.
trigger:
- platform: state
entity_id:
- switch.laundry_room_center
- switch.bathroom_l2
- switch.0x00124b00226afe36_center
- switch.0x00124b00226bba0e_left
- switch.childen_room_mirda_center
- switch.children_room_tea_center
to:
- 'on'
- 'off'
condition:
- "{{ trigger.to_state.state != states('switch.hallway_first_floor_light_grp') }}"
action:
- service: switch.turn_{{ trigger.to_state.state }}
target:
entity_id: switch.hallway_first_floor_light_grp
mode: queued
Triggered on any switch being operated (the to:
statement guards against individual switches going offline by ignoring unknown
or unavailable
states); checks that the group switch doesn’t match the new state (so if the group is on and you switch another switch on, nothing happens), then changes the group switch to match the change you made.
Typo in switch.childen_room_mirda_center
? “children”?
Sorry for the delay.
I want to change the state of the other switches when one of the switches is turned on - solved by a group of switches.
I have a problem with this - that if I turn on one switch and immediately turn off all the switches and the lights start flashing like crazy - because the automations start to mix.
Your solution sounds very good, but I can’t implement the code into HA