core: Problem with Mi Flora in 0.94.1
Home Assistant release with the issue: from 0.94.0b0 to 0.94.1
Last working Home Assistant release (if known): 0.93.2
Operating environment (Hass.io/Docker/Windows/etc.): docker
Component/platform: https://www.home-assistant.io/components/miflora/
Description of problem: Not updating and showing Unknown sensors value.
Rolled back to 0.93.2 and all working fine.
(similar problem that this with Xiaomi BLE Temperature and Humidity sensor: https://github.com/home-assistant/home-assistant/issues/24313)
I could see that in version 0.93.2 Bluepy was used and in version 0.94 Gatttool. Why?
Traceback (if applicable):
0.93.2:
2019-06-10 12:00:15 INFO (SyncWorker_9) [homeassistant.loader] Loaded miflora from homeassistant.components.miflora
2019-06-10 12:00:22 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.miflora
2019-06-10 12:00:22 DEBUG (MainThread) [homeassistant.components.miflora.sensor] Miflora is using BluepyBackend backend.
0.94.1:
2019-06-10 12:45:41 INFO (SyncWorker_7) [homeassistant.loader] Loaded miflora from homeassistant.components.miflora
2019-06-10 12:46:09 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.miflora
2019-06-10 12:46:09 DEBUG (MainThread) [homeassistant.components.miflora.sensor] Miflora is using GatttoolBackend backend.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 42 (7 by maintainers)
I have also updated the bluepy dependency in my docker image but still get “unknown”. Previously it would at least connect for a bit.
@ChristianKuehnel - this error occurs whenever there is a temporary problem communicating with a sensor (perhaps some Bluetooth radio interference?). Ideally, the error should be ignored and the sensor polled again at the next specified interval (most of us have 1200 or 1800 refresh interval configured), however once one sensor fails to respond correctly, the whole home assistant stack stops polling ALL sensors until it has been rebooted.
Here’s a suggestion about how the error could be reliably reproduced:
Create a debugging version of the miflora components that always throw the connection error. For example, if name = “debugging sensor” then throw this error:
2019-08-05 16:17:42 INFO (SyncWorker_8) [homeassistant.components.miflora.sensor] Polling error [Errno 32] Broken pipe
Install and run the miflora debugging sensor. Notice how everything crashes and no further polling occurs.
Note - the error seems to exist in the polling logic somewhere, as other sensors (such as the temperature and humidity one) are also experiencing exactly the same problems as us: https://github.com/home-assistant/home-assistant/issues/19326#issuecomment-487835712
More info: https://community.home-assistant.io/t/suddenly-no-connection-to-miflora-sensor/123074
As promised, here’s detailed logs from when the sensors stop working:
Ist seems bluepy has a Problem with Python 3.7.3 https://github.com/IanHarvey/bluepy/issues/364
I’d be happy to help creating debug logs. I have a similar problem, where my miflora sensors (I have 4 of them) work fine for a couple of hours, then just stop reporting until i restart homeassistant (
docker restart container
), after which they spring back to life and work again for a few hours.I tried migrating over to brand new install (from a Pi3-B to a Pi4), the only configuration that I copied was the sensor configuration in my configuration.yaml, otherwise it was a brand new install (to try eliminate configuration as the cause of the problem).
My HA version: 0.97.0b1
I’ve enabled debug logging, and will report back with any findings tomorrow once the issue occurs again:
Here’s my sensor config:
Oh, I also seem to have the correct bluetooth library? Here’s what my homeassistant is reporting:
(Accessed it through Portainer > Container console)