# Gate open timer - incrementing logic variables

I am trying to create a flow which gives an alert if I have left my gates open after a period of time. I created a variable “Gatetimer” and set it to zero. when the gates open I set it to 1, and then “try” and increment the variable by 1 every minute they are still open. My problem is that my Logic arithmetic doesn’t work. After it triggers I gat back a value of “NaN”.
I have attached the picture of the flows below.
Can anyone tell me what I have done wrong? And if there is a simpler way of doing this please tell me.

When you calculate you have to use double curly brace {{. You have used a single curly brace {, which gives an error. NAN= Not A Number

If you want to receive only one message after 1 minute (variable “Gate Timer” = 2), you can leave the flows as they are (don’t forget to correct the calculation).
Because with these flows the variable will not be counted higher than 2. By opening the gate you trigger the flow only 1 time. If the gate remains open, no more triggering will occur.
If you want to get a message e.g. every 10 minutes if the gate is still open, you could do this with a timer/countdown.

Edit: You can also use „Zones“ if there are no more sensors in this zone.

This is a really simple sample with “Zone” cards.
You can choose between 1, 5, 10, 15, 30, 45, and 60 minutes.
No other flows are needed.

2 Likes

Thanks for the advice re the need to double brackets, and on the tip for using zones, I have used zones at all so far.
The timer does increment however as each time it is incremented the value has changed so it increments it again after the 60 secs delay. It seems to be working well except for some fine tuning and getting it to stop and setting the timer back to zero. So a little bit more think8ng required when I get some more time.

I do not understand the meaning of the variable. What exactly are you trying to do?

I am calculating how long my gate has been open. Set the variable to one when opened, and increment after a delay of 60 secs (which can easily be changed) when the value changes. If the value equals 3 I send an alert to my phone. If still open after the value equals 5 I send another alert. If I leave the gate open inadvertently (which I sometimes do when I get distracted) I want to be notified so my pets can’t get out.

Okay, got it. That’s why I wrote about it in the previous post.
But for the process to work there are still missing more cards and flows. But I guess you know that yourself.
But in this case you don’t need a numeric variable. You can also realize this only with timer.

OK, where do I find the Timer? I haven’t found one.

There are different Timer Apps:
Timer
Countdown timer
Countdown
Chronograph
Which app you use is more or less irrelevant for your case. The apps differ slightly in their functions.

The CountDown app is supposed to be the only app that continues running after a homey restart. Furthermore, the CountDown App is currently still being maintained. That’s why I might prefer this one.

Thanks for the info. I have downloaded the App and tried to set it up but I must be doing something wrong. It doesn’t look like the timer is starting.

But u do get the message from the first flow?
The 2nd and 3th flow u need to adjust with something like:
WHEN (countdown) timer value has changed AND (countdown) Countdown is exact 45 AND contactalarm is on THEN (mobile) send message.

WHEN (countdown) timer reaches zero (0) AND contactalarm is on THEN (mobile) send message.

1 Like

Fantastic. It is now working perfectly. Thanks very much.

2 Likes