I am looking at door sensors for use with the Homey bridge. I want to detect when the door opens and upon closing the door, I want to activate a smart lock. Once the lock is activated, I don’t want it to activate again, until the door is opened and closed again. According to the settings of the lock, once activation is initiated, it will only stay activated for 30 seconds. So in summary this is what I require in order of the steps:
Detect when door opens
Wait until doors closes
Activate smart lock (lock is activated for 30 seconds according to settings in lock)
Don’t activate the lock again until the door is opened and closed again
It seems that many door sensors just do something upon the door opening e.g. turning a light on, but not upon closing again.
Does anyone know of a suitable sensor for the Homey bridge with an example flow to achieve what I want?
All contact sensors that I know have two states: opened and closed. So you can start a flow based on these events. To be certain if an app supports these events, look at the “When…” cards on the app store page for the app.
Yes but I want it to activate on closed, but not activate all the time on closed. The condition for this is that the door is first opened, then closed, then activation will happen just once until the door is opened and closed again. How to build in these conditions? What would an example flow look like?
If we set it up just to activate when door is closed, that would mean it would be activating all the time. I only want it to activate once the door is opened and then closed.
Do you mean that there should be a maximum amount of time between the door being opened and then closed? Because like I said: a door can only be closed if it has been opened before…
Never mind, I think I know what you mean.
Homey will only start a flow when the state of the door changes, so from open to closed, or from closed to open. So it will not activate “all the time” but only when the door is either opened (when it was closed before) or closed (when it was open before).
I don’t see a difference between these two sentences here.
Like Robert already tried to explain, a contact sensor works exactly that way:
only after the contact sent a “door is open” signal, it can send a “door is closed” signal. It cannot send another “door is closed” signal before it has send a “door is open” signal.
So, it always gets activated once the door is opened and then closed.
But,
when you mean “locked” and “unlocked” by the words “closed” and “opened”, please describe your case a bit clearer.
Okay I think I understand. But I don’t want it to activate upon opening, as take this scenario:
You are loading up the car with the door open and it takes you 10 minutes to load the car. You don’t want the lock activating upon open, as by the time you have loaded the car and closed the door, the lock will be inactive. The lock only activates for about 30 seconds. So I want the user to be able to close the door, at which point the lock would activate. Is there an example flow for this?
That’s what I’m trying to explain: contact sensors have two events, one that gets emitted when a door is being closed, and one that gets emitted when a door is being opened.
It’s probably “The contact alarm turned on” (meaning that the sensor made contact, which happens when you close the door and the magnet is close to the sensor).
Out of interest what would the flow look like if you wanted it to activate all the time? Example being, you wanted a light to stay on permanently when the door is closed. Is there a loop function?
Robert already answered… but seems, You still does not accept the fact that this environment is an event based
So, yes, You can also do something stupid like:
ON EVERY MINUTE - AND door is closed THEN switch the light
But usually You do not need to overload control centre. If the door is closed ( only on this event ) then switch the light. and if the door opens, then also switch the light. Time between those events the situation stays as it is. Door stays closed and light switched on. If You want elliminate the “native switch factor” - then yes, of course You can use event again, and flow something like that: WHEN light switched off AND the door is closed THEN switch light on
PS. Depending, how deep You want to go… one side situation is also when control center boots. But this also generates Event which You can easily handle with AND door is closed THEN …
Also, if there is some network issues, and You see the event loss, then may be[1] the timer based check is also needed. Usually the door and light are not so important things…
[1] NB! From my perspective this is The Bad Idea™ because:
Overloads already overloaded(?? - event loss) system
Probably system anyway uses cached (previous event ) value
The misunderstanding is due to using the word “activating”. It is much more clear to say “I switched on the light” in stead of saying “I activated the light”. Because when you switch on a light, it stays on until you switch it off.