I have a smart switch controlling some outdoor lighting at my house. It’s located in the dayroom. However, my wife has now instructed me that she wants a switch inside the house.
So, last night I installed a smart switch at another location and did not connect the switch leg – think dumb smart switch.
So basically when you hit the inside switch, it enables the outdoor switch.
I’m trying to figure out what is the best method (I use automations as well as node-red) to make both switches mirror each other. When one is pressed, it’s off. When the other is pressed it’s on and vica-versa. The only “issue” I see is I have rules setup to cut off those lights programmatically if motion isn’t detected, a door wasn’t opened for some time, etc.
Should I just create multiple rules? Am I overthinking this?
This cuts on the outdoor lights from indoor switch (enables the switch) but if it was done in reverse, cut on the switch from the dayroom, I need to poll the state of the indoor switch and change the value based on that.
However this does not allow the dayroom switch to alter the indoor switch. Adding another automation to do the reverse (dayrrom switch to control the indoor switch) gets a bit loopy (literally) without a condition in both automations:
Thanks for the help guys. I’m going to be adding an outdoor motion to the mix soon. However, I do want to know more about the light.toggle you speak off. The only issue I saw with toggle is I have an autoamtion now that cuts the light off (based on the outdoor switch). The indoor switch remained on. I guess I can add an action to cut off both switches at the same time. Can a group be used here?
Thank you. I did this with Node-Red last night, but will redo in HA automations to see if I can get it to function like I would like. Thanks again for your time.
You can use a group: use the group’s state as a trigger in an automation to set the state of all the switches in the automation.
So for example, an “Outdoor Light” group would have the two switches and the light as members, and when the group’s state is ON (meaning that one of the members is ON), the automation sets all members to on, and viceversa when it’s off.
This allows all the group’s members to be in sync, even for example if you have a smart light that you can turn on via app (without the switches): when you turn on the light via a mobile app, the two switches would reflect the light’s state.
I just completed the installation of 12 Sonoff TX3 switches in my house, and I was about to implement exactly this automation because I have many ways to turn on a light/appliance from several switches, and I wanted all to be in sync.
Yes I specified what I meant in the first phrase: you can use the group as a trigger.
And you must use homeassistant.turn_on (or turn_off / toggle) with group as entity_id so that all members (being lights/switches/etc.) transition their state.
It works perfectly:
Group definition with two switches and the controlled light:
One thing: unfortunately the GROUP logic is OR only for the ON state (if ANY member is ON, the group is ON), but it is AND for the OFF state (ALL members have to be OFF in order for the group to be OFF). So the automation unfortunately won’t be simple as it could be. It would be good if this logic could be configurable, but it isn’t.
And you insist on implying I said he was wrong…when I didn’t. Try to read my first post objectively (I’ll underline the critical part for you), or don’t, I don’t care much, you have the right to have your opinion, not your own facts.
Wrong. It can (and should) be used as a trigger, but since the group logic for OFF state is limited and not configurable, it only makes the automation not simple as it could be, you need to expand() the group and check if one of the members’ state is off to determine the OFF condition, basically replicating the default behaviour of the group’s ON state. So you need at least two triggers, one for the ON state and one for the OFF state. Sending homeassistant.action commands to the group is more efficient and logic for the scope of mirroring switches and it allows to keep the members’ state in sync.
Since you are an expert on these things, the fact that you say it’s not possible really surprises me, you are not acknowledging this proposed solution only for the sake of trying to prove I’m wrong.
I will, don’t worry, I’m still in the middle of mounting the new switches all over the house, when they’re installed, I’ll need to mirror some of them and will implement this.
The mere fact that you are saying it’s not possible is astonishing. You perfectly know it can be done, you’ve done one-liner expansion of groups more complex than this, the fact that you don’t acknowledge it can be done surprises me.
When I’ll work on it I will let you know, and if I find your same issues I’ll tell you and maybe, if you want, we could talk about possible solutions/workarounds, because ultimately I really need this to be working, I have 15 3-gang switches (Sonoff TX T3US) to install and at least 5-6 of them will have to mirror others.
Learned a lot from you during last year, while developing my Nuki Card, so I’ll be more than happy to share my findings and ask for your support.
BTW: I will tasmotize them, and I know that with Tasmota’s Device Groups functionality this could be easily done, but I want to try with HA first to see if we can overcome the group’s current limitations.