question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to connect LYWSD03MMC

See original GitHub issue

I have HA running on Raspberry Pi OS and want to connect to LYWSD03MMC devices. It seems somehow it can’t connect:

2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] Starting 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s). 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] HCIdump thread: Init 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0 2020-06-11 12:44:48 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: Run 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1 2020-06-11 12:44:48 INFO (SyncWorker_12) [custom_components.mitemp_bt.sensor] Attention! Option report_unknown is enabled, be ready for a huge output… 2020-06-11 12:44:48 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] 1 encryptors mac:key pairs loaded. 2020-06-11 12:44:48 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] 0 whitelist item(s) loaded. 2020-06-11 12:44:48 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected 2020-06-11 12:44:48 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop 2020-06-11 12:44:49 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] update_ble called 2020-06-11 12:44:50 DEBUG (SyncWorker_12) [custom_components.mitemp_bt.sensor] First run, skip parsing. 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] update_ble called 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Time to analyze… 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] HCIdump thread: joining 2020-06-11 12:45:51 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing 2020-06-11 12:45:51 DEBUG (Thread-2) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] HCIdump thread: joined 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s). 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] HCIdump thread: Init 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0 2020-06-11 12:45:51 DEBUG (Thread-18) [custom_components.mitemp_bt.sensor] HCIdump thread: Run 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1 2020-06-11 12:45:51 DEBUG (Thread-18) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection 2020-06-11 12:45:51 DEBUG (Thread-18) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected 2020-06-11 12:45:51 DEBUG (Thread-18) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop 2020-06-11 12:45:51 DEBUG (SyncWorker_10) [custom_components.mitemp_bt.sensor] Finished. Parsed: 1315 hci events, 0 xiaomi devices.

Configuration:

sensor:
  - platform: mitemp_bt
    rounding: True
    decimals: 1
    period: 60
    log_spikes: False
    use_median: False
    active_scan: False
    hci_interface: 0
    batt_entities: False
    encryptors:
              'A4:C1:38:E1:xx:xx': '39D7A24A719D7F65556B30CC70EAxxxx'
    report_unknown: True`

In the hcitrace.txt file is see the sensor showing up many times:

HCI Event: LE Meta Event (0x3e) plen 33 #18 [hci0] 1.766815 LE Advertising Report (0x02) Num reports: 1 Event type: Connectable undirected - ADV_IND (0x00) Address type: Public (0x00) Address: A4:C1:38:E1:xx:xx(Telink Semiconductor (Taipei) Co. Ltd.) Data length: 21 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported Service Data (UUID 0xfe95): 30585b050141dde138c1a4280100`

Python:

/usr/bin/python3.7 = cap_net_admin,cap_net_raw+eip`

System:

arch | armv7l dev | false docker | false hassio | false installation_type | Home Assistant Core in a Python Virtual Environment os_name | Linux os_version | 4.19.118-v7l+ python_version | 3.7.3 timezone | Europe/Brussels version | 0.110.6 virtualenv | true

Any ideas?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
Ernst79commented, Jan 3, 2021

That most likely explains it, SSD turn out to be interfering with the Bluetooth signal (I had the same issue). The FAQ gives a few hints to solve this.

Especially SSD devices are known to affect the Bluetooth reception, try to place your SSD drive as far as possible from your Bluetooth tranceiver.

What you can try is using a long cable for your SSD or using an external Bluetooth adapter, preferable with an USB extension cable. Main goal is to get the SSD as far away as possible compared to the Bluetooth radio.

0reactions
vdiogocommented, Jan 3, 2021

Did you start using an SSD? They can interfere with the BT signal.

Yes I did: don’t recall exactly when but should have been around the same time. How can I avoid it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to connect LYWSD03MMC · Issue #83 - GitHub
I have HA running on Raspberry Pi OS and want to connect to LYWSD03MMC devices. It seems somehow it can't connect:.
Read more >
Pairing Xiaomi Mijia LYWSD03MMC Bluetooth Temperature ...
Your browser can't play this video. ... Pairing Xiaomi Mijia LYWSD03MMC Bluetooth Temperature Humidity Sensor Monitor with Mi Home app.
Read more >
Home Asssistant Xiaomi Mijia LYWSD03MMC Temperature ...
Hit the Connect button. A dialog will pop up, wait until your Bluetooth device appears, choose it and hit Pair. This can take...
Read more >
Xiaomi Temperature Sensor (LYWSD03MMC) not updating
During this time the Xiaomi sensor was the only device connected over BLE to my RasPi4. Yesterday I connected two more BLE devices...
Read more >
lywsd03mmc - PyPI
Xiaomi Mijia LYWSD03MMC sensor library. ... sudo apt-get install python3-pip libglib2.0-dev ... Failed to connect to peripheral.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found