I have my lights connected to Homey via the Shelly Wave relays, in a way that they turn on and off based on automation that use either motion sensors directly, or “zone active” triggers. They were wired in a way that the physical switches on the wall retain their normal functioning
Now the problem is that sometimes I want to turn on the light and leave it on, and it’s not working. Here is what happens:
I manually turn on a corridor light because I’ll need to spend some time there
As I walk in, the motion sensor triggers a motion alarm (even though the light is already on)
After 30 seconds, the motion sensor send a “alarm turned off”, which triggers the automation and turn off the light.
To solve this I’d imagine we would need to be able to differentiate, in Homey, if a light was turned on via an automation or manually via the switch. How to do that?
I believe there is a simple solution to this, but I’m still too much of a home automation newbie to figure it out
Like I said, I described how it works conceptually. In a flow you need to add a condition to check if the switch is on, and if so, not turn off the lights.
I basically have these flows (well, automations, as I use Home Assistant):
WHEN there is motion THEN turn on the light
WHEN the switch is set to “on” THEN turn on the light
WHEN there is no more motion AND the switch is set to “off” THEN turn off the lights
The challenge that I’m having is differentiating the trigger based on whether the lights were turned on directly from the wall switch, instead of as a result of a flow. Any idea how to do that?
The image attached is what I tried, but it didn’t work. Apparently the “Turned on” state gets triggered not only when turning on from the switch but also when turned on via a flow.
As I explained, the way I’ve set this up is in detached mode. This is available on Shelly WiFi devices, I don’t know if it’s also available on Z-Wave devices.
What this does is logically detach the switch from the relay. In other words, changing the state of the switch does not change the state of the relay. All it does is send Homey a signal “Hey, the state of the switch changed”, and you can then, with a flow, act on that (or not).
That way, you can check the state of the switch and stop the light from turning off after 3 minutes of inactivity (when the switch is set in the “On” position, you keep the light on). It’s similar to what you’re doing with the “ManualOn-Ensuite” variable, however, based on a physical state (that is, the position of the switch).
AFAIK, the “Turned on/off” cards cannot differentiate between flow or switch, so you can’t use them, and I don’t know if there’s even a solution. The flow that @Peter_Kawa is showing uses a separate Button device, but in your case there isn’t one.
The detach mode is a solution. I would prefer suggesting a flow adjustment on the sensor, detaching will result the shelly does not know what the actual status is when switched by Homey instead of manual (I suppose) Keep it normal the state will be as is, regardless manual or flow switched.
If it detects movement (current it will switch shelly on), change:
You need to use a variable which is set to (f.i.) the value 2 if the flow has switched on the light, 1 if set manual (by detecting change on the status of the shelly) and will return set to 0 when off. So in the flow you use a query to check the light, not the state if it’s on, but the variable you use.
Phil
EDIT
I have something similar going with a 2-stand motor, it cannot be used in setting 1 + 2, it must be 1 or 2. In order to do so I use queries on a variable to see if the motor (shelly 2P) is set manual to 1 or 2 or by flow (time-based). It protects the option to switch 2 when 1 is on and vice versa.
Shelly knows both the state of the switch and of the relay. At least it does on Home Assistant, which I use.
You don’t need to use variables if you use the method that I described. Since Shelly can read the state of the switch, it can be used as an override for the motion sensor. But I explained all this a number of times already.
What borders me is : your variable ‘PIR motion detected’ is set to no, when there actually might be motion.
I would create a variable ‘light X is turned on manually’ which is set to YES when you manually turn on the lights. And to NO, when you turn off the lights
When motion is detected check the value of ‘ light X is turned on manually’
If YES; no action. If NO; action.
That was my initial approach, but it didn’t work, because “light turned on” is equally triggered whether it was turned on by the switch or by a Flow.
The Flow above seems to be working so far.
I see. I have several buttons around the house at strategic places. For example above the kitchen countertop. Normally the light turnes on by the lightsensor. But sometimes I need more light. And I don’t want the lightsensor to turn off the light.
So my trigger is a button pressed. You turn the light on manually by the app?