My wife doesn't want me changing the switches in the house, so I have a couple of ZBMINIs that go inside the existing switch receptacles.
I have one connected to outside lights that we can't see from inside, and that I am controlling via door contact sensor and motion sensor.
Because we can't easily see the lights from inside where the switch is, the position of the switch is important to indicate the mode to us.
If the switch is in the "on" (up) position, then I don't want my rules to ever turn off the lights.
It's not obvious for my rules how to sense the physical position of the switch. My best attempt was to use the "physical switch" trigger, and when it goes "on" to set a private bool in my motion+door rules, and when it goes "off" to clear that bool. Unfortunately it seems that the "physical switch on" trigger occurs when flicking the switch results in lights going on. Whether that's caused by flicking the switch up or flicking down. The switch just toggles the lights.
Is there a way to track the actual physical position of the switch to use as conditionals in other rules ?
Note I also tested using the standard (not "physical") switch state as a trigger, and that tracks if the lights turn on or off, as expected, whether that's caused by another rule, or by flicking the switch itself.
Colby Weinhofer figured out that:
"The ZBMINI does not seem to pay attention to whether the switch is on or off (open or closed), but functions more like a 3-way switch where the ZBMINI senses the change in the switch state and changes the state of the relay. In other words, the ZBMINI doesnāt care whether the switch is going from open to closed or closed to open, just that itās changing state."
So, that agrees with what I'm seeing. I hope there's a way around it.
Not without adding additional hardware that senses toggle position. The same issue exists for in-wall relays made by other vendors (Aeotec, Fibaro, Enerwave, Qubino).
This is advantageous for some applications, yet frustrating as heck for others. My recollection was that at least one vendor allows you to program how the switches react, but I admit that I cannot remember which. Not do I remember if they report switch state separately. Hmm ... Seems that I am not much help at all.
Hmm, that's a pity other vendors have the same issue.
If you remember the one that doesn't please let me know Hatallica!
I suppose if I could trust the starting state, and that each trigger would get through, I could perhaps get the physical switch on/off triggers to toggle a private bool in another rule, and it should theoretically always reflect the current physical switch state.
Good point. I used the Aeotec Nano at our old house for a multi-pole outlet application, so maybe that is what I was remembering.
I tried a Vision relay for a separate application and found that it would only toggle (not appropriate for what I wanted).
Now I have a few Sonoff ZB-minis to play with, but they are entirely different. I am starting our journey anew in a new house. Maybe I can learn from your path.
It's worth a shot, but it will get out of sync eventually. The good news is that if you toggle the physical switch up then down (or vice versa) really fast it only registers one change of state. Simple way to "resync" when needed. Although also the potential reason it got out of sync to begin with.
What if you used the physical on trigger to pause the other rules (motion & sensor triggered)?
I do something similar. I use a boolean to indicate that I turned the lights on at the physical switch. When that boolean is true, the motion rule will not turn them off. The only goofy part is when motion turns them on, and I want them to stay on, I have to toggle the switch twice (off then on, up then down) and now my switch is down with the lights on. Most of the time I just leave it, but sometimes I have to "fix" it.
I might take my own advice here and see if I can't figure out a way to get this to work automatically.
Yeah, I could make it so that if someone turns the switch so the lights come on, then they never turn off, but I can't tell it's in that mode without opening the door. Maybe better than now though, where any movement or door open turns the lights "on" (whether they're already on or off), and then off when motion stops and door is closed.