gkreitz / homeassistant-airthings

Quick n' dirty hack to get Airthings Wave Plus sensor into Home Assistant
Apache License 2.0
38 stars 6 forks source link

Raspberry Pi 3 Airthings stop working after 7 hours #1

Closed hteggi closed 4 years ago

hteggi commented 4 years ago

Helle thank you very much for making this component. I have been using it for a few days and noticed that it stops getting data from the device after about 7 hours. I am running hassos 3.5 home assistant 0.102.3 on a raspberry Pi 3B and this is the same issue that I had with the Xiaomi BLE Temperature/Humidity sensor and the Mi Flora plant sensor for a long time. Cant remember when this started to become a problem for those components but it used to be stable and lots of other people have the same problem. As this was working and suddenly 2 BLE components stopped working I suspect the problem was caused by hassos, Hassio or home assistant but I dont have the skills to find out where the problem is and since lots of people have BLE trouble also with BLE tracker for long time and that it not yet resolved I guess it is complicated. But I have seen that somebody has been able to fix this with a custom component: https://github.com/custom-components/sensor.mitemp_bt. Is there any chance that somebody with the right skills could do a similar fix for this component. https://github.com/home-assistant/home-assistant/issues/24313

Regards

Henning

gkreitz commented 4 years ago

Hi!

Yeah, Python libraries for BLE all seem problematic (I looked around a bit, as for a while I was considering trying to make this work natively on OS X).

Based on the README in https://github.com/custom-components/sensor.mitemp_bt , I don't believe that approach would work for Airthings at all. If I understand correctly, the MiFlora broadcasts its measurement values each second. I have not seen any indication that Airthings does anything similar - for Airthings we have to poll (which is apparently what seems to break after a while for you).

So, thank you for asking and providing the pointers, but unless I'm missing something, the approach to fix MiFlora won't be portable to this module.

This component is working well in my environment (a reasonably modern NUC), and I don't have any spare Raspberrys to try reproducing the error with. If you have a log trace showing the error happening, I could take a look at it, but if this happens for you with all BLE things, it's pretty unlikely I could fix it.

hteggi commented 4 years ago

Thanks @gkreitz for your effort. Now it looks like the bluetooth issues with the Raspberry PI 3 is fixed in hassos 3.6. I updated yesterday and airthings is still working, it has never been running this long before so if its still working tomorrow I will move the Miflora and Mitemp_BT from ESPhome to PI BT.

Regards

Henning

gkreitz commented 4 years ago

Great to hear that hassos 3.6 made some improvement to bluetooth! Thanks for reporting back with that info!