deanlyoung / homebridge-awair-local

MIT License
22 stars 2 forks source link

enhancement: Make homebridge report awair as non responsive when appropriate #15

Open gawtDamn opened 3 years ago

gawtDamn commented 3 years ago

I just sent my Awair in for servicing (hooray moving parts), and up until I restarted homebridge, the last-reported air data was still being reported as current. After restarting homebridge, the humidity was being reported as 0%, the temp as 32F (probably internally 0 degrees C), CO2 reported as 0 ppm, Air quality as unknown (this seems more or less correct), and the PM10, PM2.5, and VOC as all zero.

If it's easy to get homebridge to report "No response" after some amount of time without a measurement, or after restarting homebridge before a measurement from the Awair has arrived, that would probably be better.

deanlyoung commented 3 years ago

@gawtDamn oh, interesting... 🤔 I thought this would actually be the default behavior, like when there are errors in the code/logic. Of course, I must have inadvertently put safeguards that prevented Homebridge from crashing, but also the Accessory itself. The former is what I was striving for. I'd have to look into this, but I'm also not sure if it's possible due to this being the older "Accessory" implementation vs. the more modern/proper "Platform" implementation. In other words, I worry that causing an "Accessory" to return the error, may crash all of Homebridge, while doing the same in the "Platform" implementation would fail gracefully. Again, I'll have to check on that.