Closed khongpt closed 10 months ago
Which Openwrt version do you use and which hardware? There are some issues with bluez on 22+ OpenWrt when more than 1 active connection is used. For your case they are bm2 and wp6003. I don't have a solution for it right now besides downgrading openwrt to 21 as I don't have hardware with OpenWrt 22.03 or later.
Could handling of the org.bluez.Error.InProgress error be added somehow? I think trying to restart bluetoothd in this case is counter productive.
Can you try installing version from the branch bluez-fix
to try a new approach on scanning/connecting devices?
Does the problem still exist with this version?
pip install --no-cache-dir --force-reinstall --no-deps https://github.com/devbis/ble2mqtt/archive/bluez-fix.zip```
I've tried the bluez-fix version, and it runs really well. I've tested it with 2 passive BLE tags, 1 Mijia Temperature Humidity passive tag with ATC firmware, 2 Miflora devices, 1 Airsensor Wp6003, and 1 Battery Meter BM2. It's fantastic.
Here is configuration
{
"mqtt_host": "localhost",
"mqtt_port": 1883,
"mqtt_user": "",
"mqtt_password": "",
"log_level": "INFO",
"devices": [
{
"address": "50:54:7B:22:6C:8F",
"type": "voltage_bm2",
"interval": 60
},
{
"address": "C4:7C:8D:6C:D2:D8",
"type": "miflora",
"interval": 100
},
{
"address": "C4:7C:8D:6C:E7:AC",
"type": "miflora",
"interval": 100
},
{
"address": "A4:C1:38:DA:FB:00",
"type": "xiaomilywsd_atc"
},
{
"address": "FF:FF:10:00:07:B1",
"type": "presence"
},
{
"address": "FF:FF:C4:0C:EA:88",
"type": "presence"
},
{
"address": "60:03:03:94:2D:D9",
"type": "wp6003"
}
]
}
and results
2023-08-30 10:07:57 INFO: [Generic_iTAG_____________ffffc40cea88] send state=SensorState(presence=True, last_check=datetime.datetime(2023, 8, 30, 10, 7, 56, 970704))
2023-08-30 10:07:57 INFO: [Xiaomi_ATC_DAFB00_a4c138dafb00] send state=SensorState(battery=46, temperature=22.2, humidity=65, sends_custom=False)
2023-08-30 10:08:07 ERROR: [Generic_ffff100007b1] connection problem, attempts=8
2023-08-30 10:08:13 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:08:33 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:08:46 INFO: Connected to 50:54:7B:22:6C:8F
2023-08-30 10:08:47 INFO: [BM2_Battery_Monitor_50547b226c8f] send state=SensorState(voltage=13.78)
2023-08-30 10:08:53 INFO: Connected to C4:7C:8D:6C:D2:D8
2023-08-30 10:08:53 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.766, hcho=0.921, co2=1142)
2023-08-30 10:08:53 INFO: [Xiaomi_MiFlora_c47c8d6cd2d8] send state=SensorState(temperature=28.4, moisture=0, illuminance=0, conductivity=0, battery=46)
2023-08-30 10:08:57 INFO: [Xiaomi_ATC_DAFB00_a4c138dafb00] send state=SensorState(battery=46, temperature=22.2, humidity=65, sends_custom=False)
2023-08-30 10:08:58 INFO: [Generic_iTAG_____________ffffc40cea88] send state=SensorState(presence=True, last_check=datetime.datetime(2023, 8, 30, 10, 8, 40, 968865))
2023-08-30 10:09:13 INFO: Connected to C4:7C:8D:6C:E7:AC
2023-08-30 10:09:13 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:09:14 INFO: [Xiaomi_MiFlora_c47c8d6ce7ac] send state=SensorState(temperature=27.9, moisture=0, illuminance=1, conductivity=0, battery=68)
2023-08-30 10:09:17 ERROR: [Generic_ffff100007b1] connection problem, attempts=9
2023-08-30 10:09:33 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:09:53 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:09:55 INFO: Connected to 50:54:7B:22:6C:8F
2023-08-30 10:09:55 INFO: [BM2_Battery_Monitor_50547b226c8f] send state=SensorState(voltage=13.78)
2023-08-30 10:09:57 INFO: [Xiaomi_ATC_DAFB00_a4c138dafb00] send state=SensorState(battery=46, temperature=22.2, humidity=61, sends_custom=False)
2023-08-30 10:09:59 INFO: [Generic_iTAG_____________ffffc40cea88] send state=SensorState(presence=True, last_check=datetime.datetime(2023, 8, 30, 10, 9, 46, 963781))
2023-08-30 10:10:14 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:10:27 ERROR: [Generic_ffff100007b1] connection problem, attempts=10
2023-08-30 10:10:34 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
2023-08-30 10:10:46 ERROR: [Xiaomi_MiFlora_c47c8d6cd2d8] connection problem, attempts=1
2023-08-30 10:10:48 INFO: Connected to C4:7C:8D:6C:D2:D8
2023-08-30 10:10:49 INFO: [Xiaomi_MiFlora_c47c8d6cd2d8] send state=SensorState(temperature=28.4, moisture=0, illuminance=0, conductivity=0, battery=46)
2023-08-30 10:10:54 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.766, hcho=0.921, co2=1142)
2023-08-30 10:10:57 INFO: [Xiaomi_ATC_DAFB00_a4c138dafb00] send state=SensorState(battery=46, temperature=22.0, humidity=57, sends_custom=False)
2023-08-30 10:11:00 INFO: [Generic_iTAG_____________ffffc40cea88] send state=SensorState(presence=True, last_check=datetime.datetime(2023, 8, 30, 10, 10, 55, 966765))
2023-08-30 10:11:01 INFO: Connected to 50:54:7B:22:6C:8F
2023-08-30 10:11:02 INFO: [BM2_Battery_Monitor_50547b226c8f] send state=SensorState(voltage=13.78)
2023-08-30 10:11:04 INFO: Connected to C4:7C:8D:6C:E7:AC
2023-08-30 10:11:04 INFO: [Xiaomi_MiFlora_c47c8d6ce7ac] send state=SensorState(temperature=27.8, moisture=0, illuminance=79, conductivity=0, battery=72)
2023-08-30 10:11:14 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.651, hcho=0.902, co2=1134)
2023-08-30 10:11:34 INFO: [Vson_6003#0600303942DD9_600303942dd9] send state=SensorState(temperature=26.5, tvoc=5.708, hcho=0.911, co2=1138)
Thanks for fixing it
Released as version 0.2.0
Ble2mqtt version 0.1.8 on Openwrt
It runs okay when only declaring a BM2 sensor
However, when declaring additional sensor it reports errors, for example, addding Mijia ATC and Wp6003
This is the configuration file
Hope you can take some time to review and help resolve this issue. thanks