Page 1 of 1

Issue with OpenMQTTGateway with BLE

Posted: Sunday 23 January 2022 18:47
by tomes
Hi,
I am trying to connect OpenMQTTGateway with BLE gateway to Domoricz BETA using MQTT AD.
Unfortunately, only the switches responsible for configuring the OpenMQTTGateway are added to Domoticz. Even though I can see new BLE devices detected by the gateway in MQTT Explorer, they are not added to Domoricz. Behind the gateway there are the temperature sensors: Xiaomi Mija, Xiaomi Flora and powermeters.
Below are some examples of topics that appear in the OpenMQTTGateway tree:

homeassistant/sensor/582D34396AB3-MiJia-batt/config

Code: Select all

{"stat_t":"+/+/BTtoMQTT/582D34396AB3","name":"MiJia-batt","uniq_id":"582D34396AB3-MiJia-batt","dev_cla":"battery","val_tpl":"{{ value_json.batt | is_defined }}","unit_of_meas":"%","device":{"connections":[["mac","582D34396AB3"]],"identifiers":["582D34396AB3"],"model":"LYWSDCGQ","name":"MiJia","via_device":"OpenMQTTGateway_LOLIN32LITE_BLE"}}
homeassistant/sensor/582D34396AB3-MiJia-temp/config

Code: Select all

{"stat_t":"+/+/BTtoMQTT/582D34396AB3","name":"MiJia-temp","uniq_id":"582D34396AB3-MiJia-temp","dev_cla":"temperature","val_tpl":"{{ value_json.tempc | is_defined }}","unit_of_meas":"°C","device":{"connections":[["mac","582D34396AB3"]],"identifiers":["582D34396AB3"],"model":"LYWSDCGQ","name":"MiJia","via_device":"OpenMQTTGateway_LOLIN32LITE_BLE"}}
homeassistant/sensor/582D34396AB3-MiJia-hum/config

Code: Select all

{"stat_t":"+/+/BTtoMQTT/582D34396AB3","name":"MiJia-hum","uniq_id":"582D34396AB3-MiJia-hum","dev_cla":"humidity","val_tpl":"{{ value_json.hum | is_defined }}","unit_of_meas":"%","device":{"connections":[["mac","582D34396AB3"]],"identifiers":["582D34396AB3"],"model":"LYWSDCGQ","name":"MiJia","via_device":"OpenMQTTGateway_LOLIN32LITE_BLE"}}
homeassistant/OpenMQTTGateway_LOLIN32LITE_BLE/BTtoMQTT/582D34396AB3

Code: Select all

{"id":"58:2D:34:39:6A:B3","name":"MJ_HT_V1","rssi":-90,"model":"LYWSDCGQ","tempc":20.9,"tempf":69.62,"hum":48.9}
In logs i can see:

Code: Select all

2022-02-13 12:37:46.565  Status: EMS-ESP: discovered: Miflora/HHCCJCY01HHCC-b
att (unique_id: C47C8D6AFADA-batt)
2022-02-13 12:37:46.666  Status: EMS-ESP: discovered: Miflora/HHCCJCY01HHCC-l
ux (unique_id: C47C8D6AFADA-lux)
2022-02-13 12:37:46.767  Status: EMS-ESP: discovered: Miflora/HHCCJCY01HHCC-t
empc (unique_id: C47C8D6AFADA-tempc)
2022-02-13 12:37:46.869  Status: EMS-ESP: discovered: Miflora/HHCCJCY01HHCC-f
er (unique_id: C47C8D6AFADA-fer)
2022-02-13 12:37:46.970  Status: EMS-ESP: discovered: Miflora/HHCCJCY01HHCC-m
oi (unique_id: C47C8D6AFADA-moi)
2022-02-13 12:37:47.072  Status: EMS-ESP: discovered: Mi Jia round/LYWSDCGQ-b
att (unique_id: 4C65A8DA8812-batt)
2022-02-13 12:37:47.173  Status: EMS-ESP: discovered: Mi Jia round/LYWSDCGQ-t
empc (unique_id: 4C65A8DA8812-tempc)
2022-02-13 12:37:47.275  Status: EMS-ESP: discovered: Mi Jia round/LYWSDCGQ-h
um (unique_id: 4C65A8DA8812-hum)
But I can`t see it in Devices list.

I use MQTT Topic homeassistant/ which already works (no problem) EMS-ESP - also by MQTT AD.
I would be grateful for a hint of what I am doing wrong.

Tom

Re: Issue with OpenMQTTGateway with BLE

Posted: Thursday 16 June 2022 17:27
by bojanu
Same problem here:

2022-06-16 17:15:12.078 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Interval between scans (unique_id: 98F4AB6E6490-interval)
2022-06-16 17:15:12.179 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Connnect every X scan(s) (unique_id: 98F4AB6E6490-scanbcnct)
2022-06-16 17:15:12.279 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Force scan (unique_id: 98F4AB6E6490-force_scan)
2022-06-16 17:15:12.380 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Publish only sensors (unique_id: 98F4AB6E6490-only_sensors)
2022-06-16 17:15:12.480 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Publish HASS presence (unique_id: 98F4AB6E6490-hasspresence)
2022-06-16 17:15:12.581 Status: Auto MQTT: discovered: OpenMQTTGateway/SYS: Low Power Mode command (unique_id: 98F4AB6E6490-lowpowermode)
2022-06-16 17:15:12.682 Status: Auto MQTT: discovered: OpenMQTTGateway/BT: Connect to devices (unique_id: 98F4AB6E6490-bleconnect)
2022-06-16 17:15:12.891 Status: Auto MQTT: discovered: LYWSD03MMC/LYWSD03MMC_ATC-batt (unique_id: A4C1388B98FA-batt)
2022-06-16 17:15:12.992 Status: Auto MQTT: discovered: LYWSD03MMC/LYWSD03MMC_ATC-volt (unique_id: A4C1388B98FA-volt)
2022-06-16 17:15:13.093 Status: Auto MQTT: discovered: LYWSD03MMC/LYWSD03MMC_ATC-tempc (unique_id: A4C1388B98FA-tempc)
2022-06-16 17:15:13.193 Status: Auto MQTT: discovered: LYWSD03MMC/LYWSD03MMC_ATC-hum (unique_id: A4C1388B98FA-hum)

Temp/hum sensor discovered but not added to the devices.

Re: Issue with OpenMQTTGateway with BLE

Posted: Wednesday 04 January 2023 5:47
by 1technophile
Hello,

It may be due to the

Code: Select all

is_defined
key into the value_template.
So as to don't have it you can use the following binary from the upload page:

Code: Select all

esp32dev-ble-openhab
Or by using the following macro if you build the firmware yourself:

Code: Select all

'-DOpenHABDiscovery=true'
This way the discovery messages will not use

Code: Select all

is_defined

Re: Issue with OpenMQTTGateway with BLE

Posted: Thursday 12 January 2023 15:41
by Doler
@1technophile:
Using 'esp32dev-ble-openhab' doesn't solve the problem. The reason that the sensors are not added is probably due to the use of wildcards (+/+/) in the topic (see also viewtopic.php?t=39728). It looks like domoticz doesn't understand wildcards so a possibility to use full path would be welcome.