codersaur / SmartThings

Samsung SmartThings SmartApps and Device Handlers
Apache License 2.0
300 stars 541 forks source link

Update method for determining hub uptime #33

Closed raman325 closed 2 years ago

raman325 commented 6 years ago

Hub properties are not being written to InfluxDB

h.hub.getDataValue("uptime") is returning null which is causing the write to fail since Influx expects an integer and is instead getting the value "null". h.hub.uptime returns the unix timestamp of the last time the hub booted up and can be used to calculate uptime. Changed the variable name to better reflect the value being stored.

raman325 commented 6 years ago

This resolves https://github.com/codersaur/SmartThings/issues/32

edasque commented 6 years ago

What that ever merged?

freddyrayes commented 5 years ago

This method does not resolve correct uptime, it replaces it with last bootup time of the device. You could take the timestamp of hub last boot and subtract current time to get real "uptime" of the device.

raman325 commented 5 years ago

correct... I submitted it as a quick fix to get the rest of the properties written to InfluxDB properly and mentioned in the description that it does not calculate uptime. With that being said, I ended up fixing it on my end but did not update the original PR. I will add the changes shortly.

freddyrayes commented 5 years ago

nice, thanks. I ended up merging with 46894f1a98c6494b1dada9b4253b271704bd99af from pull request 27

using h.hub.getDataValue("uptime")), I haven't verified it yet with my influx database.

raman325 commented 5 years ago

I think you will run into the same issue that I had which led me to submitting this PR. But give it a shot, and if it doesn't work you can try the changes here

raman325 commented 2 years ago

guess there's no interest in this. I've moved off of smartthings so time for me to move on!