Miflora broken after upgrading to 0.97

Tags: #<Tag:0x00007f464c376f88>

miflora was running for weeks without problems on 0.96.x Then I upgraded to 0.97.0 and it started crashing every 8-16 hours. Same problem on 0.97.2.

2019-08-13 21:19:44 DEBUG (SyncWorker_20) [homeassistant.components.miflora.sensor] Polling data for Flower 7 Light intensity
2019-08-13 21:19:49 DEBUG (SyncWorker_20) [homeassistant.components.miflora.sensor] Flower 7 Light intensity = 0
2019-08-13 21:19:49 DEBUG (SyncWorker_20) [homeassistant.components.miflora.sensor] Data collected: [115, 0, 0, 0]
2019-08-13 21:19:49 DEBUG (SyncWorker_20) [homeassistant.components.miflora.sensor] Median is: 0
2019-08-13 21:19:49 DEBUG (SyncWorker_12) [homeassistant.components.miflora.sensor] Polling data for Flower 5 Conductivity
2019-08-13 21:19:49 INFO (SyncWorker_12) [homeassistant.components.miflora.sensor] Polling error [Errno 32] Broken pipe
2019-08-13 21:19:49 DEBUG (SyncWorker_3) [homeassistant.components.miflora.sensor] Polling data for flower_3 Light intensity
2019-08-13 21:19:59 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.flower_3_light_intensity is taking over 10 seconds
2019-08-13 21:39:44 WARNING (MainThread) [homeassistant.components.sensor] Updating miflora sensor took longer than the scheduled update interval 0:20:00
2019-08-13 21:59:44 WARNING (MainThread) [homeassistant.components.sensor] Updating miflora sensor took longer than the scheduled update interval 0:20:00

Same here. I have 8 sensors. After a hassio restart I got - sometimes - some data for one poll. Nothing more.
Running hassio 0.97.2

I can confirm I have exactly the same issue. I was going crazy trying different things, but my situation is identical to der_heinrich

All my BLE sensors from Xiaomi have been like that for ages. Running Hassio on RPi3B+ since the early 0.50’s. :sweat_smile:

I already accepted it, it might take 3-5 minutes for the BLE temperature/humidity sensors to update, MiFlora might take 10 minutes or so. Replacing the battery helped a little bit. Guessing it is an issue with the crappy BLE onboard.

Mine was working flawlessly in 0.96, the issues started after the update to 0.97

Yeah… Mine was also flawless until the 0.97 update. Usually it will run for a few hours. But one time it actually stoped polling after just one update.
@gurbina93. Problem is not that it takes time to update sensors… The miflora appears to stop polling. Probably the “Polling error [Errno 32] Broken pipe” makes the module stop.
Unfortunately i do not know how to fix it. My python skills are limited and Hassio/HA architecture knowledge I know even less.
If i could find the module I could at least have a look at it.

Yes. I think it’s an BLE 0.97 update problem.
All BLE sensors stop working after a few hours.

I wait for an update :slight_smile:

I just bought one of these and it doesn’t update for me either. I got the first set of values when I first set it up but now I just get unknown. Even when I restart. I’m on 0.97.2 :frowning:

I have the same problem.
Installed 3 xiaomi humidity and temperature sensors.
After update to V.097.2 have the Polling error [Errno 32] Broken pipe and all of them doesn’t report any value.
Downgrade to 0.96.5 with same results.
Downgrade to 0.96.0:

Disappear the error 32 but still appear a Polling error message and after some time appear this message:

Polling error Could not read data from Mi Temp sensor 4C:65:A8:XX:XX:XX
6:43 components/mitemp_bt/sensor.py (WARNING) - message first occured at 6:40 and shows up 4 times
Polling error Could not read data from Mi Temp sensor 4C:65:A8:XX:XX:XX
6:43 components/mitemp_bt/sensor.py (WARNING) - message first occured at 6:40 and shows up 5 times

But I pressed back connection button of xiaomi sensor to pair it again with “nothing” and begin to send values again.

After this upgraded version to 0.97.2 again and the “paired with nothing” sensor is still sending values.

There are any way to link BT sensors to HA like we do with phone app?
I think the problem is HA is just listening for this sensors.

True! After restarting, begin to works for few hours and stop work, in my case sensors get frezzed with last value. Anybody reported it?

Working flawlessy for me using different method

Buy a esp32 ($6).
Install ESPHome
Flash ESP32 with esphome and the miflora setup (https://esphome.io/components/sensor/xiaomi_miflora.html?highlight=miflora)

You can setup multiple ones around house. works perfectly.

2 Likes

I downgraded to 0.95.4 version, and looks like everything is working again. I used this command in a ssh session:
hassio ha update --version=0.XX.X

Would using Plant Gateway fix this kind of behavior for good?

The ESP way is cheaper, simpler and probably more reliable. Use ESP for different things like garage door opener. ESPhome is one of the reasons i went with home assistant, as I used them with other firmwares an wanted to test a simple way to program them.

2 Likes

Probably about to go down a whole rabbit hole with this, but just wanted to confirm/ask some things:

  1. ESP32 is a SoC that does what a Raspberry Pi Zero W does, but for somewhat less cash?
  2. ESP8266 was the previous version, didn’t have BT, is inside things like the Sonoff Basic?
  3. Is there a retail ESP32 with a case? All I’ve seen are dev boards and guides to 3D-print cases
  4. How much power does it need, will any shitty ol’ microUSB charger of at least 500mA work?
  5. Is flashing always done by USB or WiFi, so no need for soldering or other such butterfinger-unfriendly methods?

Thanks in advance for any info!

  1. ESP32 is a SoC that does what a Raspberry Pi Zero W does, but for somewhat less cash?

Cheaper (~$7 currently), less power, simpler programming (using ESPHome)

  1. ESP8266 was the previous version, didn’t have BT, is inside things like the Sonoff Basic?

Most IoT devices use an ESP8266 or something very similar. Tuya devices typically have a custom chip but esp8266 code still works.

  1. Is there a retail ESP32 with a case? All I’ve seen are dev boards and guides to 3D-print cases

The M5Stack https://banggood.app.link/YuuqmodcoZ is a hot kit right now. This may suite your case needs

  1. How much power does it need, will any shitty ol’ microUSB charger of at least 500mA work?

Basically any old will do. Camera add-on requires a bit more horsepower (and more power), but I have a few on whatever USB wall-warts I had sitting around with no issue.

  1. Is flashing always done by USB or WiFi, so no need for soldering or other such butterfinger-unfriendly methods?

Once you have ESPHome flashed you can update OTA.

Bonus: With ESPHome, MiFlora is as simple as writing a yaml file with:

esphome:
  name: esp32_1
  platform: ESP32
  board: esp32dev

wifi:
  ssid: "SSID"
  password: "WPA_KEY"

api:

ota:
  safe_mode: True
  password: esphome_recovery

esp32_ble_tracker:
  scan_interval: 60s

sensor:
  - platform: xiaomi_miflora
    mac_address: MAC_OF_MIFLORA
    temperature:
      name: "MiFlora Temperature"
    moisture:
      name: "MiFlora Moisture"
    illuminance:
      name: "MiFlora Illuminance"
    conductivity:
      name: "MiFlora Soil Conductivity"
    battery_level:
      name: "MiFlora Battery Level"
1 Like

This looks fantastic (and indeed quite the rabbit hole :smiley: ), just one last question: can ESPHome handle multiple things?

For example, if on the M5Stick (which has BT, WiFi, Grove port and HAT pins), I add these:

Can I then use ESPHome to get the outputs from them, as well as a Mi Flora via Bluetooth? Or how about the HAT motion sensor and 2 completely different BT devices, like a Mi Flora and a Mijia temperature+humidity sensor?

You betcha. You can add multiple sensors, can build template sensors out of data those sensors provide, etc. There’s a whole world out there! I never caught on to ESPHome until recently but now I’m sold. Feel free to DM me.

1 Like

I picked up the m5stickC yesterday hoping that it would fix my miflora and Bluetooth cracking issues.

I found that the range was very limited and it needed to be in the same room as the miflora devices. That’s OK because I can just get one per room. It might be a bit limiting for ble tracking, though.

Do you know if there’s any way to disable the screen? I’ve tried Google but there doesn’t seem to be any esphome-way of turning off the back light. Unfortunately at night it seems to shine with the ferociousness of a collapsed star.

1 Like

Duct tape over the screen? As for the range, have you tried to see how it handles walls? I’d need one that can just cross a brick wall (so ~1m distance, but through a wall).