Homey Community Forum

Help with a flow

Hi.
I need help to create a flow.
I’m a new user on homey and I’ve been creating my flows, unfortunately my knowledge is not that much on this kind of thing i’m a begginer.
I would like to receive a notification (as an example) when the door contact is active for over a minute.
I’ve a door sensor placed on a door, and i get a notification from a flow I’ve already created if the door opens, but I would like to be able to receive another notification or to play a sound on a speaker (just examples) after a certain time? Is this a easy thing to do?
Cause I can’t find a way :sweat_smile:
Thank you soo much.

Just use the card “zone active for xx minutes”

Yes, but if i have a motion sensor on the same zone, that will not work.
I need that specific device ( door sensor) to trigger the flow but only after a certain time.
Like “when” door alarm on “and” 60 seconds past with that device on “then” send me push notification.
Something like that just don’t know how to do the “and” part.

Then you might want to look into Countdown or Timer apps. There are a few on the app store. Then you could basically start a countdown time with 60 seconds when the sensor becomes active. Cancel the countdown if the sensor becomes inactive. And finally do something if the time hits 0.

1 Like

Use the countdown app. You need 2 flows. First flow, when door sensor is opened start countdowntimer xxxmin. Second flow, when countdown timer reached 0 and door is opened send push or etc. And cancel countdowntimer when door is closed

1 Like

@Shakesbeard is faster :grinning:

You could make a different zone for the doorsensor, otherwise like mention above use a countdown/timer

1 Like

I’ll try it, thank you!
@RoyWissenburg @Shakesbeard @Tolga

1 Like

I had some trouble getting all the functionality I needed from just CountDownTimer or Chronograph, so instead I used BetterLogic to create a value that increments each second, and which could be pulled into the log:

Flow number 1:
WHEN door sensor state changes
IF door sensor is open
THEN enable flow number 2
AND set BetterLogic value door_timer to 0
ELSE disable flow number 2

This will fit into one flow both the enabling and disabling of functionality: when the door opens, flow 2 is enabled and the BetterLogic “timer” is set to zero; when it closes, flow 2 is disabled

Flow number 2:
WHEN every 1 second
THEN increment BetterLogic value door_timer by 1

This creates a basic timer that measures seconds and stores the value in BetterLogic, from where it can be pulled into log entries

Flow number 3:
WHEN BetterLogic value door_timer is equal to 60
THEN print to log “Door open for <door_timer>”

Optionally, you can also create a logging flow to measure how long the door remained open:

Flow number 4:
WHEN door sensor state is changed to closed
THEN print to log “Door closed after <door_timer>”

The THEN function of the above flow can also be merged into flow 1 as an ELSE function, as flow 1 already checks for door sensor state changes.

The value for door_timer persists until the door is reopened, so it can be used by subsequent flows for whatever purpose deemed necessary, or it could be reset to zero as part of the THEN portion of flow 4 (with a 1 second delay so that the log entry will not print as 0). It would also make sense to create a log entry for opening the door, and perhaps grouping them together into a log group for legibility.

Building further functionality on top of this system is relatively simple, because BetterLogic values can be used as WHEN triggers, for IF comparisons and manipulated by THEN events.

Enjoy your time tinkering with Homey!

1 Like

You don’t need timers. Just two flows will work fine
First you need to create this flow. If you execute this flow, it will play a sound if the door is open:


And you activate this flow with this flow:

It gets activated when a door is opened. And after a delay of 60sec it starts the first flow. If the door is still open it plays the sound. Otherwise not.

2 Likes

I’ve been able to reach what i needed with cowntown, still it’s good to know other options and to get more knowledge about the capacities of homey, I’ll give it a try to your solution and even use it with other needs of mine.
Thank you :ok_hand:

1 Like