1) Give a description of the problem
I have a device connected to a smart plug and would like to create a piston so that once we are away and if the device is on, it is turned off and a push notification is sent to us.
2) What is the expected behaviour?
I’d like the notification to include the time the device has been on since, i.e. “Device has been turned off. It was on since {time}”
3) What is happening/not happening?
I’m comfortable enough creating the piston - the only bit I don’t know how to do is include the time since the device has been on in the push notification. Do I need a separate piston to save the current time to a variable whenever my device state changes to on? And then refer to this variable in the push notification of my main piston? Or is there a slicker way to do it?
Thanks!