Polling error Could not read data from Mi Temp sensor

Hi! I have a clean HA installation which I just setup using latest hassio on a rpi3. I’m trying to make it read my new Xiaomi Temperature and Humidity sensors v2 (this one https://www.aliexpress.com/item/4000434285871.html). I only enabled the samba add-on and added the following in my configuration.yaml.

sensor:
  - platform: mitemp_bt
    name: Bedroom Temp Sensor
    median: 1
    mac: 'A4:C1:38:4A:FA:DF'
    timeout: 60
    monitored_conditions:
      - temperature

When I restart hass.io I get the following errors:

TypeError: ord() expected a character, but string of length 15 found
2020-01-05 14:22:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.bedroom_temp_sensor_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/mitemp_bt/sensor.py", line 156, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 126, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 59, in fill_cache
    self.firmware_version()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 106, in firmware_version
    self.battery = int(ord(res_battery))
TypeError: ord() expected a character, but string of length 15 found
2020-01-05 14:23:06 WARNING (SyncWorker_5) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4:C1:38:4A:FA:DF
2020-01-05 14:23:33 WARNING (SyncWorker_16) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4:C1:38:4A:FA:DF

Any ideas? I hear that rpi bluetooth reception isn’t great so I currently placed the sensors just next to the pi.

Can anyone help with this? I never managed to fit it.

It doesn’t work. Nobody knows for now what’s the exact reason. I’ve tried different RPs but without luck. After couple of hours it just starts throwing polling errors. I’ve heard that a solution based on ESPHome (https://esphome.io/components/sensor/xiaomi_lywsdcgq.html) is much more stable and my plan is to try it.

Br,

Alen

I have the same problem since months. Any suggestion?

I just received my Xiaomi Temperature and Humidity sensors v2, and I’m facing the same issue :frowning:

Blockquote
2020-07-28 20:51:51 DEBUG (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling data for Kids_Room_Sensor Battery

2020-07-28 20:51:52 WARNING (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling error

2020-07-28 20:52:21 DEBUG (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling data for Kids_Room_Sensor Temperature

2020-07-28 20:52:21 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4:C1:38:9B:F7:55

2020-07-28 20:52:21 DEBUG (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling data for Kids_Room_Sensor Humidity

2020-07-28 20:52:21 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4:C1:38:9B:F7:55

2020-07-28 20:52:21 DEBUG (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling data for Kids_Room_Sensor Battery

2020-07-28 20:52:22 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error

I’m on rpi4 with HA v0.113.1.

Same here with HA v0.113.0. Whatta pity - really looked forward to using these sensors…

@Laia

I managed to make them work, 4 of them, with the Xiaomi passive BLE Monitor HACS integration : and method/tool :https://github.com/custom-components/sensor.mitemp_bt/issues/7#issuecomment-646424495

Hope that helps :slight_smile:

Hey @Benouzao,

this sounds really great! I will have a look at this and afterwards, I will give a shout if it was successful in my case, too. I also got 4 of them.

Can you give me an advise regarding HACS and this custom component? I am a bit careful regarding custom modules, because I am afraid of them breaking all my installation when I am upgrading my HomeAssistant version… Is it that “dangerous” I think about it?