What is the simplest way to count time elapsed between last system start and %now%?

In Rule Machine?
TIA
Perhaps rather than %now% , current date and time.

you could do this with 2 rules in RM.

1st rule will capture the start time of hubitat and place it in a global variable (in epoch seconds):
trigger: on system start
action: set global variable "lastSystemStart" to now() in seconds

the 2nd rule you can run whenever you need the difference between last system time and now:
trigger: whatever your needed trigger(s) is(are)
action: set local variable "timeNow" = now() in seconds
set local variable "timeSinceLastSystemStart" = variable timeNow - variable lastSystemStart

this will give you a local variable that holds seconds since last restart. you can convert to minutes/etc if needed. depending on need, you can make the "timeSinceLastSystemStart" a connector variable so it is exposed as a virutal device to be used else where, or make it a global variable..

I prefer to use epoch time to store and compare dates and then format it when it needs to be outputted for human reading, but RM gives you options for both, just play around with it and ask if you get stuck (with screenshots).

This could also be handled by a custom app or driver, however, depends on what your use case is. if you have more details about what you want to do, we might be able to give you more practical answers that better fit your need.

1 Like

That was purrrrrrfict!
Had the rules, stumbling over the logic.
Agree on epoch time.
Thank you for your help.