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
71.34k stars 29.88k forks source link

Bluetooth "DEAD" in Docker Homeassistant 0.95 #24792

Closed bachoo786 closed 4 years ago

bachoo786 commented 5 years ago

Home Assistant release with the issue: 0.95

Last working Home Assistant release (if known):

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

Component/platform:

Description of problem: Bluetooth on docker has stopped working and connecting to switchbot and xiaomi bt temp and humidity sensor. The problem started with 0.94.3 upgrade. I have been running docker with network mode as host and that has not changed from my end.

I have restarted my NUC to see if it would be resolved but no joy. Furthermore bluetoothctl is working fine on my NUC without docker.

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

  - platform: mitemp_bt
    mac: '58:2D:34:32:E1:6F'
    name: Living Room Temp
    force_update: true
#    median: 3
    monitored_conditions:
      - temperature
      - humidity
      - battery

  - platform: switchbot
    mac: 'f9:ec:2b:10:9a:0b'
    name: Bedroom Lights

  - platform: switchbot
    mac: 'd7:2e:95:d5:29:38'
    name: livingroom lights

Additional information:

2019-06-27 10:46:16 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:46:46 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:47:17 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:47:48 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:48:19 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:48:50 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:49:21 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:49:51 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:50:22 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:50:53 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:51:24 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:51:55 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:52:26 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:52:57 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:53:28 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:53:59 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:54:30 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:55:01 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:55:32 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:56:03 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:56:34 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:57:05 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:57:36 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:58:07 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:58:38 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:59:09 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 10:59:40 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 11:00:10 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30

Please look into it as I had opened an issue during the 0.94.3 but it seems like it went unnoticed.

Thanks.

EDIT: (More error logs):

2019-06-27 13:52:19 WARNING (SyncWorker_19) [switchbot] Failed to connect to Switchbot
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/switchbot/__init__.py", line 35, in _connect
    bluepy.btle.ADDR_TYPE_RANDOM)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral d7:2e:95:d5:29:38, addr type: random
2019-06-27 13:52:19 ERROR (SyncWorker_19) [switchbot] Cannot connect to switchbot.
2019-06-27 13:52:22 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:52:42 WARNING (SyncWorker_15) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_15, started daemon 139800287889152)>)
2019-06-27 13:52:42 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:52:52 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:52:53 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:53:23 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:53:38 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_13, started daemon 139800304674560)>)
2019-06-27 13:53:54 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:53:54 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:54:04 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:54:25 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:54:49 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_11, started daemon 139800866690816)>)
2019-06-27 13:55:06 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:55:27 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:55:54 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_4, started daemon 139801261360896)>)
2019-06-27 13:55:54 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:55:54 WARNING (SyncWorker_12) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:55:57 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:55:57 WARNING (SyncWorker_12) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:56:07 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:56:28 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:56:44 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_7, started daemon 139800900261632)>)
2019-06-27 13:56:59 WARNING (SyncWorker_15) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:57:09 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:57:30 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:57:55 WARNING (SyncWorker_12) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_12, started daemon 139800313067264)>)
2019-06-27 13:58:01 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:58:05 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_humidity is taking over 10 seconds
2019-06-27 13:58:32 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:58:48 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_11, started daemon 139800866690816)>)
2019-06-27 13:59:03 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 13:59:13 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 13:59:34 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 13:59:48 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_0, started daemon 139801300211456)>)
2019-06-27 13:59:48 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 14:00:15 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.living_room_temp_battery is taking over 10 seconds
2019-06-27 14:00:36 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2019-06-27 14:00:55 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_7, started daemon 139800900261632)>)
2019-06-27 14:00:55 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 14:00:55 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 14:01:07 WARNING (SyncWorker_15) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
2019-06-27 14:01:07 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:32:E1:6F
bachoo786 commented 5 years ago

bluepy 1.3.0 seems like to be working with python 2.7, 3.3 and 3.4. HA (0.95) in docker is running Python 3.7.3, could that be the reason why its Bluetooth is not working in docker?

pgodinic commented 5 years ago

Any solution?

scottyphillips commented 5 years ago

Also seeing this error, it has killed mitemp and BLE device tracker...

TheRealBadRobot commented 5 years ago

I have same issue.

Maegfea commented 5 years ago

Same Here

MartyTremblay commented 5 years ago

Seems to be working again sine 0.97

Anyone else experiencing this as well?

Poeschl commented 4 years ago

Still experiencing this on Hass.io with 0.99.3

CsepregiArtur commented 4 years ago

stil having it

stale[bot] commented 4 years ago

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.

Poeschl commented 4 years ago

Still existing for me, currently getting some BLE temp/hum sensors. Will report back how it works with 103.6 and HassOS 3.8.

cbagger commented 4 years ago

Switchbot still not working for me on a fresh installed Hass.io on my RPI3B+.

0.104.3 installed. Have been an issue for months. :(

Poeschl commented 4 years ago

After some more googling: https://github.com/IanHarvey/bluepy/issues/364

stale[bot] commented 4 years ago

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.