johnlemonse / homebridge-telldus

36 stars 22 forks source link

use "lastUpdated" to show when sensor was updated #25

Open tvillingett opened 7 years ago

tvillingett commented 7 years ago

Is it possible to use this timestamp (unixtime?) to give as info to homekit. I'm not sure where/how to send it to homekit... {"id":"9044149","name":"Garage inne","lastUpdated":1478118807,"ignored":0,"client":"130828","clientName":"Torodd1","online":"1","editable":1,"battery":254,"keepHistory":0,"protocol":"fineoffset","model":"temperaturehumidity","sensorId":"231"}

mifi commented 7 years ago

Where does homekit show timestamps? There is a CurrentTime characteristic but I don't know what it's supposed to mean.

https://github.com/KhaosT/HAP-NodeJS/blob/7fb8c2924e8bb08a548bf101d0605db09a6f6952/lib/gen/HomeKitTypes.js

tvillingett commented 7 years ago

Hmm, I was assuming it existed, but it may be only as internally registered time from receiving an update. The CurrentTime I believe is for setting the internal real time clock of accessories, for their own timestamp when logging time-series of data. In this case maybe it could use the timestamp to save and check if the data is newer than the last sent, and don't resend it if it was the same, and then the homekit app on iOS will mark it as not updated.

mifi commented 7 years ago

Then we would need to save state in the program? That should be avoided if possible

dezral commented 6 years ago

could this not be possible now with the sensor/history in the telldus API?