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.35k stars 29.89k forks source link

mitemp_bt.sensor not working #46803

Closed dalanmiller closed 3 years ago

dalanmiller commented 3 years ago

The problem

Not sure if hass is unable to communicate with bluetooth device, the below logs were shown using --debug so unsure how to get lower level to the issue.

I can confirm via the command line that I can use bluetoothctl to scan for LE broadcasts just fine, including the device I'm looking to listen for.

What is version of Home Assistant Core has the issue?

2021.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

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

Example YAML snippet

$ cat configuration.yaml


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

sensor:
  - platform: mitemp_bt
    mac: '<MAC>'
    name: Kitchen Sensor
    force_update: true
    median: 1
    monitored_conditions:
      - temperature
      - humidity
      - battery

Anything in the logs that might be useful for us?

$ hass -c . --debug
2021-02-20 05:55:35 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2021-02-20 05:55:42 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=25 from 2021-02-20 05:52:04.211159)
2021-02-20 05:56:44 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.kitchen_sensor_temperature is taking over 10 seconds
2021-02-20 05:57:04 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2021-02-20 05:57:04 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_4, started daemon 139833661187840)>)
2021-02-20 05:57:04 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4-C1-38-28-1D-5D
2021-02-20 05:57:14 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.kitchen_sensor_battery is taking over 10 seconds
2021-02-20 05:57:34 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2021-02-20 05:57:35 WARNING (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_1, started daemon 139834168239872)>)
2021-02-20 05:58:04 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4-C1-38-28-1D-5D
2021-02-20 05:58:04 WARNING (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4-C1-38-28-1D-5D
2021-02-20 05:58:14 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.kitchen_sensor_battery is taking over 10 seconds
2021-02-20 05:58:34 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2021-02-20 05:58:34 WARNING (SyncWorker_5) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_5, started daemon 139833652795136)>)
2021-02-20 05:59:04 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4-C1-38-28-1D-5D
2021-02-20 05:59:04 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor A4-C1-38-28-1D-5D
2021-02-20 05:59:14 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.kitchen_sensor_battery is taking over 10 seconds
2021-02-20 05:59:34 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30
2021-02-20 05:59:34 WARNING (SyncWorker_2) [homeassistant.components.mitemp_bt.sensor] Polling error Exit read_ble, no data (<Thread(SyncWorker_2, started daemon 139834159322880)>)

Maybe related?

probot-home-assistant[bot] commented 3 years ago

mitemp_bt documentation mitemp_bt source (message by IssueLinks)

dalanmiller commented 3 years ago

Changed logging to DEBUG and am seeing this:

hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Running gatttool with a timeout of 20: gatttool --device=A4-C1-38-28-1D-5D --addr-type=public --char-read -a 0x24 --adapter=hci0
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Finished gatttool
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Got "" from gatttool
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Waiting for 40 seconds before retrying
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Running gatttool with a timeout of 20: gatttool --device=A4-C1-38-28-1D-5D --addr-type=public --char-read -a 0x24 --adapter=hci0
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Finished gatttool
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Got "" from gatttool
hass                    | 2021-02-27 21:21:19 DEBUG (SyncWorker_0) [btlewrap.gatttool] Waiting for 40 seconds before retrying
romano1508 commented 3 years ago

Hi ,

Same result today with a fresh VM install. Bluetooh devices are listed with bluetoothctl

Same issue : Polling error Exit read_ble, no data (<Thread(SyncWorker_4, started daemon 140341234047776)>) Polling error Could not read data from Mi Temp sensor 58:2D:34:3A:DO:AC Polling error Exit read_ble, no data (<Thread(SyncWorker_0, started daemon 140341359409952)>)

cjitariu commented 3 years ago

I'm seeing workers in parallel trying to poll and no one is able to get the values: 2021-03-12 19:15:10 WARNING (SyncWorker_1) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:15:10 WARNING (SyncWorker_8) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:15:40 WARNING (SyncWorker_10) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:15:40 WARNING (SyncWorker_2) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:16:10 WARNING (SyncWorker_7) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:16:10 WARNING (SyncWorker_5) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:16:40 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:16:40 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:17:10 WARNING (SyncWorker_10) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:17:10 WARNING (SyncWorker_6) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:17:50 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.camera_temperature is taking over 10 seconds 2021-03-12 19:18:10 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30 2021-03-12 19:18:40 WARNING (MainThread) [homeassistant.components.sensor] Updating mitemp_bt sensor took longer than the scheduled update interval 0:00:30 2021-03-12 19:18:50 WARNING (SyncWorker_12) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:18:50 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:19:10 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:19:10 WARNING (SyncWorker_13) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:19:40 WARNING (SyncWorker_12) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:19:40 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:20:10 WARNING (SyncWorker_6) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:20:10 WARNING (SyncWorker_5) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:20:40 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:20:40 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:21:10 WARNING (SyncWorker_4) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:21:10 WARNING (SyncWorker_10) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:21:40 WARNING (SyncWorker_3) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:21:40 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:22:10 WARNING (SyncWorker_11) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B 2021-03-12 19:22:10 WARNING (SyncWorker_0) [homeassistant.components.mitemp_bt.sensor] Polling error Could not read data from Mi Temp sensor 58:2D:34:39:9E:6B

kimvognsen commented 3 years ago

Me too Polling error Exit read_ble, no data (<Thread(SyncWorker_8, started daemon 139669996960544)>) Polling error Exit read_ble, no data (<Thread(SyncWorker_15, started daemon 139669966498592)>) Polling error Exit read_ble, no data (<Thread(SyncWorker_13, started daemon 139669991615264)>) Polling error Could not read data from Mi Temp sensor 00:19:0e:19:25:a5 Polling error Exit read_ble, no data (<Thread(SyncWorker_4, started daemon 139670323776288)>)

asifma commented 3 years ago

Also having same issue...

mef-hamburg commented 3 years ago

This is because the "ecryption" or "bind_key" feature has been removed.... most of these devices encrypt the bluetooth data. It used to work until recently in HA???

--> until recently it was possible to have this in the YAML: encryptors: '[MAC]': '[encryption string]'

Newest update to this sensor does not seem to allow encryption key anymore?

I need to use the HACS integration now...

oddbytes commented 3 years ago

I updated HA today (I was using hacs integration) and also noticed this change, what about the encryption support? My sensors arent working either.

tommitytom commented 3 years ago

Likewise - why was encryption support removed? Is there a workaround?

github-actions[bot] commented 3 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 has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.