FlyingDiver / Indigo-miniUniFi

Minimalistic UniFi plugin for Indigo
MIT License
0 stars 0 forks source link

Offline_seconds not updating, and needs rounding #17

Closed jstewart99 closed 4 years ago

jstewart99 commented 4 years ago

Created a new device with v 0.12 (my phone). Device presently shows Online, but shows offline_seconds of 63.473367. I assume this happened when I walked briefly out of wifi range, however now that I'm back IN range, shouldn't it update the offline_seconds back to 0? Seems like that value isn't ever going to reset.

Also if you could just round the seconds to the nearest second, I'm not sure anyone needs millionths of a second or whatever that shows. ;-)

FlyingDiver commented 4 years ago

That's just an artifact of the way the UniFi controller reports the data. The "last_seen" field from the controller is not updated in real time. You go by the sensor state of the device - if it's ON, then the device is online. If it's OFF, then it's off-line and the offline time is somewhat accurate. It's not updated in real time, so it's only approximate.

FlyingDiver commented 4 years ago

It's currently a float. I guess I could convert to a integer before I save it.

FlyingDiver commented 4 years ago

I could also force it to zero if it's online. I guess that makes more sense.

FlyingDiver commented 4 years ago

Fixed in next release. Both rounding and forcing to zero.