home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.82k stars 30.51k forks source link

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

Closed dxdx65 closed 4 years ago

dxdx65 commented 5 years ago

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 commented 5 years ago

still not fixed in 0.97.0. devices "unknown"

ronytomen commented 5 years ago

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

dxdx65 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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

dxdx65 commented 5 years ago

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 commented 5 years ago

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

dxdx65 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

I have the same issue

Isking007 commented 5 years ago

I have the same issue

xiaoxin01 commented 5 years ago

@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 commented 5 years ago

But the they're not zigbee or z wave?

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

dxdx65 commented 5 years ago

@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 commented 5 years ago

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

dxdx65 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

A320Peter commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

Isking007 commented 5 years ago

Problem disappeared on 0.99.3. I'm happy 🤗

batwingnz commented 5 years ago

Give it a few more hours it will break lol

Isking007 commented 5 years ago

4 days left ...lol

batwingnz commented 5 years ago

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 commented 5 years ago

Yes, I really enjoy it. My torment is over

dxdx65 commented 5 years ago

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 commented 5 years ago

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

apat183 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

https://github.com/home-assistant/home-assistant/issues/24313

thiagogalvao commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

iromeo commented 4 years ago

UPDATE: poller script replacement doesn't help, alternative solution - use HACS component with mitemp_bt support, see (thanks to https://github.com/home-assistant/core/issues/24313#issuecomment-558518704), 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/)

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

iromeo commented 4 years ago

UPDATE2: Still doesn't work, Raspberry Pie bluetooth goes DOWN after some time, see 3 workarounds here https://github.com/home-assistant/core/issues/24313#issuecomment-602021023

lucagiove commented 4 years ago

It's fixed in hassos 3.13

thiagogalvao commented 4 years ago

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

lucagiove commented 4 years ago

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: https://github.com/home-assistant/core/issues/24313#issuecomment-578554315

jrmckins commented 4 years ago

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 commented 4 years ago

6 days on 3.13 and it's been solid.