Time difference between two events?

Is it possible to create a rule in RM that sends out the time difference between two logged events or to show this on a dashboard ?

Eg
switch on at 1pm
Switch off at 2pm

Send a push notification on the off event ā€œthe switch was on for 60 minutesā€

D

1 Like

Yes. But if you're looking for a possible setup, we'd need a lot more info. Are you looking to track the time between two specific devices? Or to track the difference between a whole bunch of different devices.

Might I ask, what are going to use this for? Why is this information important to you?

In the broad strokes, it involves the use of number variables and the function of setting the variable equal to the current time in Seconds.

You record a variable when each event occurs, then use variable math to subtract one from the other and divide by 60 to get the minutes. You can then use a connector to send that variable to a device to display on a dashboard.

Itā€™s actually to track the time my cleaner is in the house, I know when she enters based on the alarm being set/unset as this is mapped to the status of a switch.

Iā€™d want a push notification on the day she is scheduled to come to tell me the number of hours between unset and set of the alarm...

Thanks !

Yup, that is possible. Might I also suggest you might want to send that to IFTTT to be tracked in Google Sheets? That way, you don't have to keep track via the push and there is a long-term record.

1 Like

Thanks for this. Just been having a play, it doesnā€™t look like global variables support a datetime type unfortunately..

No, but you don't need it to. The "Time in Seconds" is in Epoch time. That means that you do direct arithmetic and you don't have to do time math because both numbers are a count of the number of seconds since Jan 1st 1970 at 12am. So, when you record the time twice, you can subtract one from the other and get the number of seconds. Then divide by 60 for the number of minutes. Trust me....try using the variable as I screenshotted above. It works.