On Time from rest API


First post - I couldn’t find this question answered or asked, so thought I’d ask it. Apologies however if its a duplicate >_<

I would like to be able to set some of my lights to timer, say, the garage light or hall way light to be on for 10 minutes then switch off. I’ve wrote a python script that can do this, but I can’t find anyway to tell how long the light has been on for from the API. The only way I can think of doing it, is the python script will run say, every 1 minute, and count the number of cycles since the script ‘noticed’ the light was on. Then switch it off after a given number of cycles - basically, a ‘dirty hack’ lol.

Is there something in the API I can use to extract this ‘on time’ data to save using the above method, or anything in the works for future API releases?

Thanks in advance! :slight_smile:



The HTTP API doesn’t currently expose how long a device has been connected for, we may look into adding this in the future.