ThomDietrich / miflora-mqtt-daemon

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼πŸ₯€πŸ‘🌳
MIT License
606 stars 141 forks source link

Failed to retrieve data from Mi Flora sensor but `bluetoothctl` detects all data #151

Closed rindlerblabla closed 2 years ago

rindlerblabla commented 2 years ago

I am new to this but I don't get it working. Am using a Raspberry pi 4b with raspbian. When running sudo hcitool lescan the sensor is detected as C4:7C:8D:62:01:76 (unknown) and when using bluetoothctl it updates with

[CHG] Device C4:7C:8D:62:01:76 ServiceData Key: 0000fe95-0000-1000-8000-00805f9b34fb
[CHG] Device C4:7C:8D:62:01:76 ServiceData Value:
71 02 98 00 01 76 01 62 8d 7c c4 0d 09 10 02 00  q....v.b.|......
00    

However it still fails to retrieve data when running the test:

Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
Source: https://github.com/ThomDietrich/miflora-mqtt-daemon

[2022-01-27 09:43:04] Connecting to MQTT broker ...
[2022-01-27 09:43:04] MQTT connection established

Adding sensor to device list and testing connection ...
Name:          "Palettblad"
[2022-01-27 09:43:11] Initial connection to Mi Flora sensor "Palettblad" (C4:7C:8D:62:01:76) failed due to exception:

[2022-01-27 09:43:11] Announcing Mi Flora devices to MQTT broker for auto-discovery ...
[2022-01-27 09:43:11] Retrieving data from sensor "Palettblad" ...
[2022-01-27 09:43:19] Retrying ...
[2022-01-27 09:43:26] Failed to retrieve data from Mi Flora sensor "Palettblad" (C4:7C:8D:62:01:76), success rate: 0%

[2022-01-27 09:43:26] Sleeping (300 seconds) ...

The sensor is placed just next to the Pi. Any suggestions on how to solve this? Don't think it should be related to weak bluetooth since it updates just fine with bluetoothctl?

rindlerblabla commented 2 years ago

Don't know if it is related, but I also have these error messages.

● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-01-27 11:21:21 CET; 13s ago
       Docs: man:bluetoothd(8)
   Main PID: 1121 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 4915)
        CPU: 65ms
     CGroup: /system.slice/bluetooth.service
             └─1121 /usr/libexec/bluetooth/bluetoothd --compat --noplugin=sap -E NotifyAccess=main

jan 27 11:21:21 vardagsrummet systemd[1]: Starting Bluetooth service...
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Bluetooth daemon 5.55
jan 27 11:21:21 vardagsrummet systemd[1]: Started Bluetooth service.
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Excluding (cli) sap
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Bluetooth management interface 1.18 initialized
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Failed to set mode: Rejected (0x0b)
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Failed to set mode: Rejected (0x0b)
jan 27 11:21:21 vardagsrummet bluetoothd[1121]: Failed to set privacy: Rejected (0x0b)
rindlerblabla commented 2 years ago

Think this is range related. Works with an bluetooth dongle. Closing the issue.