Looking for a door sensor that will activate a flow upon opening and then closing door?

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:

  1. Detect when door opens
  2. Wait until doors closes
  3. Activate smart lock (lock is activated for 30 seconds according to settings in lock)
  4. 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.

For example Aqara:

IKEA:

Aeotec:

Etc…

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?

Perhaps I don’t understand, but the way you describe it:

WHEN the door is closed THEN activate lock

Because a door can only be closed after it has been opened first.

:man_shrugging:t3:

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.

You want to start a flow based on the former.

So when the door is closed would that be “The contact alarm turned off”?

  • 00:00 - Door closed - nothing
  • 00:01 - door closed - nothing
  • 00:02 - someone opens the door - event “Contact alarm”
  • 00:03 - door opened - nothing
  • 00:04 - door opened - nothing
  • 00:05 - someone closes the door - event “Contact alarm off”
  • 00:06 - door is closed - nothing
  • 00:07 - door is closed - nothing
  • 00:08 - someone opens the door - event “Contact alarm”

The flow can be triggered by only “Contact alarm” or by only “Contact alarm off”

Or, if You want, then also have a 2 different driggers :cowboy_hat_face:

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?

WHEN the door is closed THEN turn on the light
WHEN the door is opened THEN turn off the light

Or in a single flow:

WHEN the door is closed THEN turn on the light ELSE turn off the light

Does anyone know if the Shelly Shelly BLU Door and Window Sensor is compatible with homey bridge?

This guide from Homey says it is:

But when I go onto the Shelly app for Homey, the door and window sensor is not mentioned there? Has support been discontinued?

The app developer has never been able to test it on the bridge, that’s why it’s not marked as supported. The best buy guide has been wrong before.

But for Homey pro the device is not mentioned on the app page either?

1 Like

Robert already answered… but seems, You still does not accept the fact that this environment is an event based :wink:

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:

  1. Overloads already overloaded(?? - event loss) system
  2. 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.