Days counter variable

Hi all, I am trying to build a simple counter of days after I replace a blade in my razor, when I turn a switch. When I turn the same switch again, it would trigger the rule again and start all over again.

So far I have the below logic -- I haven't tested it yet as waiting for the first midnight, but my question is -- do I need that last statement to stop the repetition or will triggering this rule, while the previous instance is still 'repeating' effectively restart the rule and thus stop that previous repeating cycle?

TIA!

Are you prompt in replacing the blade?
If you are why not just run a periodic trigger for every 3 weeks to send a notification.

I wrote this example for you using local variables - will work like a charm and you can vary easily the # of days between reminders just by changing the threshold variable (in this example this variable is set to 30 days). Hope this helps jj

2 Likes

You can also add a connector to the two local variables if you want to see or adjust them in a dashboard. One last thought to make it 'snooze button simple' would be to create a virtual button and add it as a trigger. In actions add a condition statement to reset the "Razor Day Count" to zero if this button gets pushed in a dashboard. I prefer set and forget personally. jj

2 Likes

That's brilliant!! So I now have the following. I don't always change that blade when I should, so I want that reminder to continue every day after the initial week. I also want the counter to change overnight, but send me the notification in the morning. At lastly, I am planning on having an NFC tag in my en-suite that resent the counter -- when I change the blade, I swipe my phone against the tab, and get a confirmation.

Am I missing anything or this should work?

1 Like

As @furom mentioned, I would like this rule to do what you said but also a bit more. :slight_smile:

2 Likes

Very lean and mean, I like what you did! That will work like a champ. jj

2 Likes

Insert above your last END-IF;
turn off your virtual switch named Razor Day Reset.

you push the "Razor day reset" button on the dashboard, switch goes on, routine fires, switch turns off. Right now you will have to manually turn it off; either that or make it a toggle. I like the first method better so you can see how long it takes to run the routine by how long the light stays on in the dashboard from the time you press it - it should be a blink. well done. jj

1 Like

Yep, very good point. You are right, I set up the switch as a toggle with 2s delay, but I like your approach more. Thanks a lot again!!!

1 Like

@jjackson - perhaps you might know the answer to this question as well. The rule seems to be working, i.e. it added a count of 1 overnight to the local variable, but my dashboard tile based on that variable doesn't seem to be updating (remains at 0). I set the local variable up as a Variable connector and then added to the dashboard as a Variable Number tile template (also tried all the other Variable tiles).

Do you know what I might be doing wrong...?

Nope, dashboard refreshes don't help...

Untitled 8

Great suggestion, but unfortunately still no joy... Very strange... :confused:

What variable type do you have for this variable? Number, Decimal, etc.?

Hmm, mine is a local variable, so perhaps that's the difference that makes it work for you but not for me...? I will try to change to a global variable and see what happens.

Here is the answer - that is a bug i have reported for months. Number variables if they are "local variables" are not reporting properly to the dashboard. The work around is to create a "global variable" and use it rather than your local variable. Replace the local variables in your rule with global variables - Global Variables are working with dashboard fine as relates to using number variables. Took me a bit to figure it out.

2 Likes

Brilliant! And consistent with the experiences that I've exchanged with @furom. I just changed my variables to global and the tile is showing the correct value -- let's see if it updates tomorrow.

Thanks again!!

1 Like

Glad to help, jj

1 Like

I suggest that you report the bug to support too. The more the user issues the higher the chance of getting attention. HE development is great, the are just busy as heck. j

2 Likes

Why people don't like to countdown to 0? :slight_smile: