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?


I made a small test, a little different from the OP's question, triggered every second, and my point/question is about the variable don't update on the dashboard...?

To the dashboard I added the switch and the variable, but did not work so far. Is there a known problem with using variables like this?



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


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


That is the other way around, and not as much fun... :wink: But yes, would also work, but the way it's setup now one can make statistics of when and how long a particular brand held up...


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:


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


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...?

Did it update correctly after a dashboard refresh? (green check-mark in upper corner)

Nope, dashboard refreshes don't help...

Untitled 8

Ah, got it. If you try

Does it work then? I had no success with the 'Variable Number' either... I have the same connector set up as you too

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

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

I use number as type, Variable as connector;

The variable itself is a global RM variable if that can change anything...

1 Like

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.