I tried I suppose every solution from this forum but none of them works as I expect. I simply want to hard link 2 toggles in Hass. I have following setup: There are 2 lights in the room and one RF wall switch. I put two lights into one group.
In this way switches can function regardless of group toggle but also with the group toggle I can switch on/off both of them together. The behaviour is exactly what I want.
Recently I added RF wall switch and simply want to control group toggle with it.
light.kitchen_wall_switch
But unfortunately all solutions I found here are suggesting to use service/data templates. In my case it looks as follows:
But this automation doesn’t work as desired in case when I want to turn on only one of the lights. It changes state of the wall switch which triggers this automation once again setting all lights on. What I want is simply link a group toggle to a wall switch toggle without any workarounds and delays etc.: group.kitchen_card <==> light.kitchen_wall_switch.
I made an illustration for easier understanding what I need:
Thank you Tom for your reply. Not exactly what I want to achieve.
In this case if I turn the lights or at least one light On from UI the status of RF switch doesn’t reflect the status of the group and I need to turn On the wall switch just to set status of the wall switch in order to turn Off the lights.
It looks like very simple use case but to be honest I can’t find the solution for a long time.
I’ve read this thread 4 times and I just don’t get it.
You have one switch and two lights but you don’t want to switch them together as Tom suggests ?
Can you draw a truth table of device settings (on/off for L1, L2) and Sw1 then what you change and what you want the outcome to be ?
No, that’s bad programming practice and will cause the action to crash if an unexpected condition (not a problem here because there is no elif) but then any subsequent action would not occur. So just try to stay out of bad habits.
Edit; ‘if’ there’s an ‘if’ there’s ‘always’ an ‘else’.
I want RF switch to work exactly as Group of lights. I want to switch all lights On/Off together with RF button. Also I want to switch lights On/Off individually from UI and able to turn them Off with RF button.
I could do this but I’d need to create an intermediary blocking boolean to stop the changing of the light switch from the trigger of the light to turn on the other light. Tricky as Tom says.
Let’s see what he comes back with.
Unfortunately same as I mentioned before but in two separate rules.
Exactly, Tom’s solution is the same as I mentioned in the first message. If I turn at least one light On then it triggers second rule Kitchen RF Switch On Group which triggers the first Kitchen Light On Wall Switch because of light.kitchen_wall_switch is On
So, create an input boolean switched to on when you switch one of the lights (double trigger, double action)
The input boolean is first
The input boolean ‘on’ triggers timer to switch it off (2 secs ?) third automation
The switch operation has a condition that the boolean must be off