Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5 #25704

Closed
dxdx65 opened this issue Aug 5, 2019 · 51 comments

Comments

@dxdx65
Copy link

dxdx65 commented Aug 5, 2019

Xiaomi BLE Temperature and Humidity sensors no longer discovered and working after upgrade from 0.95.4 to 0.96.5.

i.e in states:
sensor.termometro_bt_xiaomi_temperature | unknown

in info:

Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
11:49 helpers/entity_platform.py (WARNING) - message first occured at 11:04 and shows up 88 times

In the original Xiaomi BT app the devices are correctly discovered and shown.

@dxdx65
Copy link
Author

dxdx65 commented Aug 8, 2019

still not fixed in 0.97.0. devices "unknown"

@ronytomen
Copy link
Contributor

Can you use the issue template? It would really help to know and understand the environment where Home Assistant is running.

@dxdx65
Copy link
Author

dxdx65 commented Aug 9, 2019

Home Assistant release with the issue:

0.97.0

Last working Home Assistant release (if known):

0.95.4

Operating environment (Hass.io/Docker/Windows/etc.):

hass.io on raspberry 3B+
hassOs 2.12
zWave USB key installed

serial:
    /dev/ttyAMA0
    /dev/serial/by-id/usb-0658_0200-if00
    /dev/ttyACM0
input:
disk:
    /dev/mmcblk0p2
    /dev/mmcblk0p7
    /dev/mmcblk0p8
    /dev/mmcblk0p1
    /dev/mmcblk0p5
    /dev/mmcblk0
    /dev/mmcblk0p3
    /dev/mmcblk0p6
    /dev/mmcblk0p4
gpio:
    gpiochip128
    gpiochip0
audio:
    0:
        name: bcm2835_alsa - bcm2835 ALSA
        type: ALSA
        devices:
            [object Object]
            [object Object]

Component/platform:

https://www.home-assistant.io/components/mitemp_bt/

Description of problem:
I use 3 BLE temp & hum sensors directly connected to the raspberry BT adapter.
In rev 0.95.4 they were correctly detected and interfaced, Since my upgrade to 0.96.5 (and now 0.97.0) the detectors are no longer discovered (devices "unknown" ) and displayed. I tried to reboot both devices and raspberry without any result. Devices are correctly detected and shown on the original Xiaomi Home app.
Same for my BT thermostats (eq3) while phone and ather BT devices are correctly managed.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

  - platform: mitemp_bt
    mac: '4c:65:a8:df:03:75'
    name: termometro BT xiaomi
    force_update: true
    median: 1
    timeout: 20
    cache_value: 60
    monitored_conditions:
      - temperature
      - humidity
      - battery

  - platform: mitemp_bt
    mac: '58:2d:34:32:13:35'
    name: termometro BT xiaomi 2
    force_update: true
    median: 1
    timeout: 20
    cache_value: 60
    monitored_conditions:
      - temperature
      - humidity
      - battery

Traceback (if applicable):


Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
12:35 helpers/entity_platform.py (WARNING) - message first occured at 8 agosto 2019, 11:35 and shows up 2906 times

Additional information:
it seems related to the climate upgrade since version 0.96.0

@mikeybeck
Copy link

I had problems with this sensor for ages but eventually managed to get it working on 0.96.x and 0.97.1.
I tried so many things that unfortunately I don't know exactly what was required, but...
Have you tried removing spaces from the name setting in the config? I'm sure I read somewhere that some guy had issues with this sensor until he removed the spaces from the name.
Just now, I tested my config with the name termometro BT xiaomi and the sensor value was no longer detected. Then I removed the name entirely (that's how I have it normally) and it worked again.

FYI I still get the Updating mitemp_bt sensor took longer than the scheduled update interval message but it works anyway.

@dxdx65
Copy link
Author

dxdx65 commented Aug 12, 2019

@mikeybeck
thanks for the tip but in my case it didn't work. i tried to remove all spaces and even shorten the names to a couple of letters but the devices are not discovered yet. I guess it's something in the new climate configuration since ver 0.96 that changed and must be updated...

@batwingnz
Copy link

Your issue mirrors mine nearly exactly, except the sensors can appear to be working for several hours after resetting them they still eventually fail. I too have to keep rolling back to 0.95.4, but haven't tested 0.97.2 yet.

@hudzikj
Copy link

hudzikj commented Aug 19, 2019

@batwingnz
I had the same. I upgraded to 0.97.2. And so far it works properly over two days.

@dxdx65
Copy link
Author

dxdx65 commented Aug 19, 2019

I made today a fresh installatiopn of 0.97.2 on the SD of my raspberry and, configuring the BLE sensors, they were coerrectly read this time.
But it lasted a couple of hours, than again all of them "unknown" (same for my EQ3 thermostats). In the log it seems that it was coincident to the update of CLI 6 internal climate module... No way , even with back up, to restore the correct reading now.
What can it be??

@batwingnz
Copy link

Yes it works for a few hours but not for many days on end like 0.95.4

@dxdx65
Copy link
Author

dxdx65 commented Aug 20, 2019

I tried again with a fresh 0.97.2 installation, just configuring the BLE termometers. It worked.
As I tried to restore a saved snapshot , it did not recognize any longer the devices. It seems something between the climate componente and the BT interface, as it locks at the same time also my BT EQ3 thermostats.

From my log:

2019-08-20 10:31:18 WARNING (MainThread) [homeassistant.components.climate] Setup of platform eq3btsmart is taking over 10 seconds.
2019-08-20 10:31:22 WARNING (SyncWorker_10) [homeassistant.components.eq3btsmart.climate] Updating the state failed: Failed to connect to peripheral 00:1A:22:12:DC:13, addr type: public
2019-08-20 10:31:49 WARNING (Dummy-3) [openzwave] Z-Wave Notification DriverFailed : {'notificationType': 'DriverFailed', 'homeId': 0, 'nodeId': 255}
2019-08-20 10:31:56 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error 
2019-08-20 10:32:03 WARNING (SyncWorker_6) [homeassistant.components.mitemp_bt.sensor] Polling error 
2019-08-20 10:32:03 WARNING (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2d:34:31:16:5c
2019-08-20 10:32:13 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.studio_battery is taking over 10 seconds
2019-08-20 10:32:19 ERROR (SyncWorker_8) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 31, in discover_devices
    lookup_class=lookup_class, device_id=device_id)
_bluetooth.error: (110, 'Operation timed out')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 115, in update_bluetooth_once
    for dev in discover_devices():
  File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 72, in discover_devices
    device_id=device_id,
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 34, in discover_devices
    raise BluetoothError ("error communicating with local "
bluetooth.btcommon.BluetoothError: error communicating with local bluetooth adapter
2019-08-20 10:32:21 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-08-20 10:32:25 WARNING (SyncWorker_5) [homeassistant.components.mitemp_bt.sensor] Polling error 
2019-08-20 10:32:32 WARNING (SyncWorker_9) [homeassistant.components.mitemp_bt.sensor] Polling error 
2019-08-20 10:32:32 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2d:34:32:13:35
2019-08-20 10:32:42 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.esterno_battery is taking over 10 seconds
2019-08-20 10:32:43 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.room2 is taking over 10 seconds
2019-08-20 10:32:48 ERROR (SyncWorker_1) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/bluetooth/bluez.py", line 31, in discover_devices
    lookup_class=lookup_class, device_id=device_id)
_bluetooth.error: (110, 'Operation timed out')

Can someone help there???

thanks a lot

@dxdx65
Copy link
Author

dxdx65 commented Aug 21, 2019

another note on the same issue: on 0.97.2, if I wipe & restore a snapshot with a previously working configuration, the BT devices are recognized and displayed correctly. Two breaking points then:

  1. I wait around 2 hours and then the BT climate devices (sensors, thermostats) are no longer recognized (but my BT phone still yes...)
  2. I insert and try to configure my aeotec zwave USB key 5th gen, (the BT stops working immediately for all the climate sensors and thermostats. BT polling errors in log). This same configuration, also with Zwave key and sensors, was fluently and continuosly working with version 0.95.4 and before.

Can it help to individuate the bug?

Thanks

@dxdx65
Copy link
Author

dxdx65 commented Aug 22, 2019

I confirm that downgrading the system to 0.95.2, everything started to work again like before. Only the Zwave USB dongle still caused a crash to BT devices but configuring directly zwave /dev/ttyACM0 port on configuration.yaml it started to work without affecting the BT . I therefore confirm that it is an issue related to 0.96 and next revision, that affect climate & BT devices. i hope it can be fixed in a future release

@Ener-G

This comment has been minimized.

1 similar comment
@Isking007

This comment has been minimized.

@xiaoxin01
Copy link

@dxdx65

I had the same issue and resolved by doing this:

sudo systemctl disable ModemManager 

reference:

https://www.home-assistant.io/hassio/installation/#debianubuntu

The modemmanager package will interfere with any Z-Wave or Zigbee stick and should be removed or disabled. Failure to do so will result in random failures of those integrations. For example you can disable with sudo systemctl disable ModemManager and remove with sudo apt-get purge modemmanager

@batwingnz
Copy link

batwingnz commented Aug 30, 2019

But the they're not zigbee or z wave?

Is your suggestion even relevant for hass.io or only an install over debian?

@dxdx65
Copy link
Author

dxdx65 commented Aug 31, 2019

@xiaoxin01

Thanks but I could verify that, even with a fresh installations (097 and latest 0.98) , the Climate related BT devices can work only for a couple of hours, then are no longer recognized. This happened also without using or inserting the Z-wave USB dongle.
Therefore the Z-WAVE might cuase an additional effect, but it ìs not the originary cause of this issue.

Anyway I use hassio.

Thanks again

@batwingnz
Copy link

I tried lastest update, it worked for about 12 hours but still eventually broke down and now it fails to restore snapshot. Great.

@dxdx65
Copy link
Author

dxdx65 commented Sep 4, 2019

I tried to install also on a rasp2 and rasp zero w. WITH VERSION 0.98.3
Everything worked smoothly for a couple of hours, than all at once stopped (both XIAOMI BLE termometers. and eq3bt THERMOSTATS.
Is it possible to contact the developer of this integration to ask if he is available to make a check??
I'm sure it's something related to bluetooth driver or cache.......

Help needed GUYS..!!!

@Febersoi
Copy link

Febersoi commented Sep 4, 2019

I am having the exact same issue, also on hass.io raspberry 3B+ with version 0.98.3.
My XIAOMI BLE thermometers work for around 2 to 8 hours and then stop working with the exact same error in the log.
After restarting home assistant they work again for some time.

@gronat
Copy link

gronat commented Sep 14, 2019

MiJia sensor readings being stop updated after about 2-5h. Does work for a while again whe hassio is restarted.

To reproduce the error:
RPi 3B+
hassio 0.98.5

config.yaml:

  - platform: mitemp_bt
    name: Room Temp
    mac: 58:2D:34:33:xx:xx
    force_update: true
    median: 1
    monitored_conditions:
      - temperature
      - humidity
      - battery

ui-lovelace.yaml

      - type: history-graph
        title: 'Temperature & Humidity Sensors'
        entities:
          - entity: sensor.room_temp_temperature
            name: Room 
        refresh_interval: 5

from log:

2019-09-14 13:46:01 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.balcony_temp_humidity is taking over 10 seconds
2019-09-14 13:56:44 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.balcony_temp_humidity is taking over 10 seconds
2019-09-14 14:42:43 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_temperature is taking over 10 seconds
2019-09-14 15:14:05 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.2\x00'
2019-09-14 15:14:06 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.3\x00'
2019-09-14 15:14:43 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.6\x00'
2019-09-14 15:14:44 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.7\x00'
2019-09-14 15:15:13 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.4\x00'
2019-09-14 15:15:14 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.5\x00'
2019-09-14 15:15:41 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.3\x00'
2019-09-14 15:15:42 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.5\x00'
2019-09-14 15:16:16 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_temperature is taking over 10 seconds
2019-09-14 15:16:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.3\x00'
2019-09-14 15:16:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.2\x00'
2019-09-14 15:16:43 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.1\x00'
2019-09-14 15:16:44 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.1\x00'
2019-09-14 15:17:18 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_humidity is taking over 10 seconds
2019-09-14 15:17:25 WARNING (SyncWorker_15) [homeassistant.components.mitemp_bt.sensor] Polling error 
2019-09-14 15:17:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_temperature is taking over 10 seconds
2019-09-14 15:17:39 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-09-14 15:17:39 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.5\x00'
2019-09-14 15:18:18 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.room_temp_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, 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 159, in update
    data = self.poller.parameter_value(self.parameter)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
    self.fill_cache()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 68, in fill_cache
    connection.wait_for_notification(_HANDLE_READ_WRITE_SENSOR_DATA, self, 10)  # pylint: disable=no-member
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/btlewrap/bluepy.py", line 89, in wait_for_notification
    return self._peripheral.waitForNotifications(notification_timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 560, in waitForNotifications
    resp = self._getResp(['ntfy','ind'], timeout)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 416, in _getResp
    self.delegate.handleNotification(hnd, data)
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 195, in handleNotification
    self._check_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 144, in _check_data
    parsed = self._parse_data()
  File "/usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 177, in _parse_data
    res[MI_HUMIDITY] = float(data[9:13])
ValueError: could not convert string to float: '9.8\x00'
2019-09-14 15:23:30 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_temperature is taking over 10 seconds
2019-09-14 15:44:41 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.room_temp_humidity is taking over 10 seconds

@A320Peter
Copy link

A320Peter commented Sep 14, 2019

I have exactly the same problem. After updating from 0.95.4 to 0.98.5 all of my three Xiaomi temp sensors have stopped working. Entity state is unknown. For me they never pick up any value. Error log only shows:

Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30

It looks like some bluetooth issue. Downgrading to 0.95.4 and everything works. I never had a problem with them on 0.95.4 I had been using them since the release.

I have Pi3 B+ and Hassio.

@gronat
Copy link

gronat commented Sep 16, 2019

The problem still persists after downgrading to 0.95.4 and rebooting the RPi.

@A320Peter
Copy link

I confirm this. It worked for a while but then stopped. So it doesn't work after downgrading. But before upgrading to 0.98 it was perfectly working on 0.95.4

@apat183
Copy link

apat183 commented Sep 16, 2019

Your issue mirrors mine nearly exactly, except the sensors can appear to be working for several hours after resetting them they still eventually fail. I too have to keep rolling back to 0.95.4, but haven't tested 0.97.2 yet.

I'm getting this exact issue, after reset works for couple of hours then nothing. I ssh into my ubuntu environment and check sudo bluetoothctl and check bluetooth is working fine and it is, I can even see the Xiaomi devices but Home Assistant cant. I'm using docker if it helps as well.

@batwingnz
Copy link

I've been trying updates then rolling back. Last night HA disappeared off the network, turns out the USB and ethernet died spontaneously on pi 3 b+.

When I got back in it had updated from 0.95.4 to 0.96.2 by itself ( no idea how that's possible since the updater would take it to 0.98.5). Anyway I restored my 0.95.4 snapshot and now my sensors don't come back at all, looks like I'll be forced to a clean install but if ethernet is dead that's gonna suck.

@Harshajv
Copy link

The problem still persists even with 0.99.3
Works for couple of hours and then there are no updates.

@Isking007
Copy link

Problem disappeared on 0.99.3. I'm happy 🤗

@batwingnz
Copy link

Give it a few more hours it will break lol

@Isking007
Copy link

4 days left ...lol

@batwingnz
Copy link

It's been running 4 days? My pi 3 died and I got a pi 4 but builds for it started after 0.95.4 so I've literally had no homeassistant while waiting for a fix.

@Isking007
Copy link

Yes, I really enjoy it. My torment is over

@dxdx65
Copy link
Author

dxdx65 commented Oct 1, 2019

No.. does not work.
I made a fresh installation of 0.99.3 and the sensor worked only for a couple of hours, then all of them stopped like usually. I'm afraid is something limiting the size of the database, that fills at a certain point and does not accept any new value. they have to fix this....

@dxdx65
Copy link
Author

dxdx65 commented Oct 1, 2019

@Isking007 : can you please share your sensor configuration? I'd realize if you have something different or customized.... Thanks

@apat183
Copy link

apat183 commented Oct 2, 2019

No.. does not work.
I made a fresh installation of 0.99.3 and the sensor worked only for a couple of hours, then all of them stopped like usually. I'm afraid is something limiting the size of the database, that fills at a certain point and does not accept any new value. they have to fix this....

Are you able to expand on database issue? If that is issue then it's something that can be looked into more, currently I'm not able to figure out issue at all.

@apat183
Copy link

apat183 commented Oct 2, 2019

So not sure if this helps, but when I restart home assistant, I get the following error which hangs the restart (i have to manually restart docker image) for home assistant to start again. but it's interesting that it's has to do with the bluepy which is the bluetooth python module home assistant is using, could this be crashing? Or is it just coincidence?

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 630, in __del__
    self.disconnect()
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 453, in disconnect
    self._writeCmd("disc\n")
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 305, in _writeCmd
    self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

@apat183
Copy link

apat183 commented Oct 7, 2019

For anyone looking for a solution since issue still being investigated, I've ended up doing the following:

  1. On my Ubuntu server which host Home assistant docker environment, installed this: https://github.com/algirdasc/xiaomi-ble-mqtt
  2. Spun up a MQTT docker broker (https://hub.docker.com/_/eclipse-mosquitto/)
  3. Add MQTT integration to home assistant
  4. Added the sensors as MQTT sensors instead in configuration file.

Working way better, getting no time out issues or anything, it seems like it's pulling the data way more consistently then via home assistant in docker. I thought I was having issues due to bluetooth range but doing it this way I can pull from all my Xiaomi sensors better.

@bojleros
Copy link

#24313

@thiagogalvao
Copy link

I suspect that the lost of bluetooth connection occour when logout from xserver. I'm running Home assistant 0.102 on RPi 3+ with Docker.

@bas89
Copy link

bas89 commented Dec 21, 2019

I just noticed that these errors like
ValueError: could not convert string to float: '9.8\x00'
only occur when having one-digit temperatures below 10°C. So it's basically a parsing error.

@lucagiove
Copy link

Look at #24313 seems that a custom component works better but there is still an open discussion how to integrate it https://github.com/custom-components/sensor.mitemp_bt

@tomascrespo
Copy link

I just noticed that these errors like
ValueError: could not convert string to float: '9.8\x00'
only occur when having one-digit temperatures below 10°C. So it's basically a parsing error.

Replace your file mitemp_bt_poller.py with the lastest (this one) and your problem will be solved.

This is the original project where updates are published: https://github.com/ratcashdev/mitemp
Download the last mitemp_bt_poller.py from here and replace yours

@jrmckins
Copy link

I can't find mitemp_bt_poller.py on my system anywhere. Where is it located?

@iromeo
Copy link

iromeo commented Mar 20, 2020

UPDATE: poller script replacement doesn't help, alternative solution - use HACS component with mitemp_bt support, see (thanks to #24313 (comment)), see https://github.com/custom-components/sensor.mitemp_bt


@jrmckins In order to get last mitemp_bt_poller.py from https://github.com/ratcashdev/mitemp:

Login via ssh to HassOS host (see https://developers.home-assistant.io/docs/hassio_debugging/)

  • login to root
ha> login
  • open home assistant container
$ docker exec -it homeassistant /bin/bash
  • find required file:
$ find / -name mitemp_bt_poller.py

in my case result is: /usr/local/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py

  • backup original file & download new one
$ mv mitemp_bt_poller.py mitemp_bt_poller.py.bk
$ cd  /usr/local/lib/python3.7/site-packages/mitemp_bt
$ wget https://raw.githubusercontent.com/ratcashdev/mitemp/master/mitemp_bt/mitemp_bt_poller.py
  • reboot home assistant host

P.S: I've done this for my Home Assistant 0.107.1 (RbP 3B), let's see whether it helps or not

@iromeo
Copy link

iromeo commented Mar 21, 2020

UPDATE2:
Still doesn't work, Raspberry Pie bluetooth goes DOWN after some time, see 3 workarounds here #24313 (comment)

lucagiove added a commit to lucagiove/operating-system that referenced this issue Mar 25, 2020
This problem is referenced in many different issues, some of them:
Bluetooth: hci0: Frame reassembly failed (-84)
raspberrypi/firmware#1150

Error communicating with local bluetooth adapter (RPi3)
home-assistant/core#30147

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5
home-assistant/core#25704

Xiaomi BLE Temperature and Humidity sensor
home-assistant/core#24313 (comment)

Solution seemed to reeduce the boud rate of the serial connection to BT
on rpi3b where flow control is missing.

The patch to the original btuart file is to reduce the baudrate only for
rpi3b models where flow control is missing:

-		$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+		$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR

I'm not a buildroot expert but the best way seemed to move the
upstream btuart download in a PRE_PATCH_HOOK so that standard
buildroot way of patching can be applied.
lucagiove added a commit to lucagiove/operating-system that referenced this issue Mar 25, 2020
This problem is referenced in many different issues, some of them:
Bluetooth: hci0: Frame reassembly failed (-84)
raspberrypi/firmware#1150

Error communicating with local bluetooth adapter (RPi3)
home-assistant/core#30147

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5
home-assistant/core#25704

Xiaomi BLE Temperature and Humidity sensor
home-assistant/core#24313 (comment)

Solution seemed to reeduce the boud rate of the serial connection to BT
on rpi3b where flow control is missing.

The patch to the original btuart file is to reduce the baudrate only for
rpi3b models where flow control is missing:

-		$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+		$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR

I'm not a buildroot expert but the best way seemed to move the
upstream btuart download in a PRE_PATCH_HOOK so that standard
buildroot way of patching can be applied.
pvizeli pushed a commit to home-assistant/operating-system that referenced this issue Mar 31, 2020
This problem is referenced in many different issues, some of them:
Bluetooth: hci0: Frame reassembly failed (-84)
raspberrypi/firmware#1150

Error communicating with local bluetooth adapter (RPi3)
home-assistant/core#30147

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5
home-assistant/core#25704

Xiaomi BLE Temperature and Humidity sensor
home-assistant/core#24313 (comment)

Solution seemed to reeduce the boud rate of the serial connection to BT
on rpi3b where flow control is missing.

The patch to the original btuart file is to reduce the baudrate only for
rpi3b models where flow control is missing:

-		$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+		$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR

I'm not a buildroot expert but the best way seemed to move the
upstream btuart download in a PRE_PATCH_HOOK so that standard
buildroot way of patching can be applied.
pvizeli pushed a commit to home-assistant/operating-system that referenced this issue Apr 15, 2020
This problem is referenced in many different issues, some of them:
Bluetooth: hci0: Frame reassembly failed (-84)
raspberrypi/firmware#1150

Error communicating with local bluetooth adapter (RPi3)
home-assistant/core#30147

Xiaomi BLE Temperature and Humidity sensor no longer working after update from 0.95.4 to .096.5
home-assistant/core#25704

Xiaomi BLE Temperature and Humidity sensor
home-assistant/core#24313 (comment)

Solution seemed to reeduce the boud rate of the serial connection to BT
on rpi3b where flow control is missing.

The patch to the original btuart file is to reduce the baudrate only for
rpi3b models where flow control is missing:

-		$HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR
+		$HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR

I'm not a buildroot expert but the best way seemed to move the
upstream btuart download in a PRE_PATCH_HOOK so that standard
buildroot way of patching can be applied.
@lucagiove
Copy link

It's fixed in hassos 3.13

@thiagogalvao
Copy link

thiagogalvao commented Apr 22, 2020

Is it fixed in docker version too? or just to the hassos ?
I will try update my version running into the docker.

@lucagiove
Copy link

It's fixed only in HassOS because the issue was at low level in the serial communication with the BT rpi module.
If you're using a differente distribution you can try to fix it manually like explained here:
#24313 (comment)

@jrmckins
Copy link

It's fixed in hassos 3.13

This has been working for many days for me. I'm on 3.12 but will upgrade to 3.13 today.

@jrmckins
Copy link

6 days on 3.13 and it's been solid.

@stale
Copy link

stale bot commented Jul 27, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 27, 2020
@stale stale bot closed this as completed Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests