Help with json configuration file.

Python and python framework

Moderator: leecollings

Post Reply
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Help with json configuration file.

Post by Dave21w »

I've been at this for a few days now but I'm really stuck and would appreciate a little guidance if possible.
I have some cheap BLE trackers I would like to use for presence detection. I am already using the openmqttgateway running on an esp32 and this gets the cheap Xiaomi Mi temp/hum sensors into Domoticz without issue.
I've installed the MqttMapper plugin and configured my json file, my 2 ble tags are generated in the Domoticz Utility Tab as I want them, correct name etc but the rssi (recieved signal strength indication) value I'm trying to read is always 0. I know the value is visible as I can see it using MQTT Explorer and I see the below in the Domoticz Log.
2023-12-15 07:21:26.585 MQTT Mapper: Setting iTag2 to >{'id': 'FF:FF:10:F8:A7:9F', 'mac_type': 0, 'adv_type': 0, 'name': 'iTAG ', 'manufacturerdata': '0501ffff10f8a79f6602010300', 'rssi': -59}<
2023-12-15 07:21:06.084 MQTT Mapper: Setting iTag to >{'id': 'FF:FF:C4:09:FF:D1', 'mac_type': 0, 'adv_type': 0, 'rssi': -72, 'txpower': 0}<

Here is my json file which is obviously wrong or missing something even though I see no errors in the log about it.

{
"iTag": {
"topic": "homeassistant/ESP32_BLE/BTtoMQTT/FFFFC409FFD1",
"type": "243", "subtype": "31", "switchtype": "0",
"mapping": {"item": "", "rssi": " ", "values": ""}},
"iTag2": {
"topic": "homeassistant/ESP32_BLE/BTtoMQTT/FFFF10F8A79F",
"type": "243", "subtype": "31", "switchtype": "0",
"mapping": {"item": "", "rssi": " ", "values": ""}}
}

Thanks
Dave
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

I dont understand: You use Openmqttgateway that uses (or can use) MQTT Auto Discover. Why would you need MQTTmapper plugin?
if the openmqttgateway is not sending the rssi correct then have it repaired in openmqttgateway.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

With out the MqttMapper Domoticz does not have any knowledge of the device type so even though they are present in mqtt they are not created in Domoticz.
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

Did you enable the HA Autodiscover option in OpenMQTTgateway? As that should trigger the correct messages so Domoticz can understand those and create the devices automatically (when in domoticz the MQTT Autodiscover gateway is added).
https://docs.openmqttgateway.com/integr ... stant.html
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

That is enabled by default anyway but yes I have checked and (I assume) it would not detect and create (in Domoticz) my temp/hum sensors

2023-12-15 09:14:38.553 Status: MQTT Auto: discovered: TH Sensor-F67AD9 (LYWSD03MMC/MJWSD05MMC_ATC-batt)/TH Sensor-F67AD9 (LYWSD03MMC/MJWSD05MMC_ATC-batt)
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

Do you have a Domoticz Auto Discovery client gateway enabled?

https://www.domoticz.com/wiki/MQTT#Add_ ... Gateway.22
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

I do, with the auto discovery prefix set to homeassistant, again if this was not correct I guess other devices would not be detected
User avatar
jvdz
Posts: 2329
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Help with json configuration file.

Post by jvdz »

Have you also send a correct data payload for that discovered device as sensor type devices are only created after the first time some data is received?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

With MqttMapper enabled and my current json file each time the ble device transmits the last seen value in thw widget is updated so i know some information is being recieved, just not the rssi value
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

Dave21w wrote: Friday 15 December 2023 11:33 With MqttMapper enabled and my current json file each time the ble device transmits the last seen value in thw widget is updated so i know some information is being recieved, just not the rssi value
That lastseen should be fixed in latest beta already.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

Perhaps check what AD config and state messages are being created by OMG. If Domoticz is not recognizing this tracker device correctly, make a github issue with these AD config and state message so the devices will be recognized correctly (including rssi).
https://docs.openmqttgateway.com/use/bl ... qtt-broker

You should not create a mqttMapper config file for an MQTT AD compatible device.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

Thanks for your reply @waltervl, I've been trying a few things over the weekend without success. Despite the device in question seemingly advertising it's self as an iTag I suppose it's possible that it isn't supported by Domoticz and therefore cannot be automatically identified.
I have updated the OMG firmware from 1.6 to 1.7 and now have some of my previous devices being detected slightly differently (temp/hum sensors now show as 2 devices instead of 1 - not really an issue) and now I see presence listed under the homeassistant topic in MQTT Explorer and see each each of my BLE devices shown in sequence but still nothing in Domoticz.
I have also noticed that some devices like this one that I have:
https://www.amazon.co.uk/gp/product/B08 ... UTF8&psc=1
show up and I can see following in Domoticz
489 MQTT Auto FD3800001B2A-volt 1 ThermoBeacon Batt General Voltage 2.919 V
823 MQTT Auto FD3800001B2A-hum 1 ThermoBeacon-001B2A (WS02/WS08-hum) Humidity LaCrosse WS2300 Humidity 50
824 MQTT Auto FD3800001B2A-tempc1 ThermoBeacon-001B2A (WS02/WS08-tempc) Temp THR128/138, THC138 24.8 C
827 MQTT Auto FD3800001B2A-time 1 ThermoBeacon-001B2A (WS02/WS08-time) General Text 5.08254e+06
However this device also sends it's rssi along with some other info but none of that is visible, should I also have the rssi value shown for this as well ?

Sorry for all the questions, I feel like ths learning curve for this is a virtical line at the moment.

Thanks
Dave
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

It seems that presence devices are not yet implemented in Domoticz.

You can create a domoticz github issue with your config and state topics (for presence at home and away) to have it implemented.
We do not have presence switches in Domoticz so probably they will become normal on/off switches. Not sure what it will become.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Dave21w
Posts: 381
Joined: Sunday 29 November 2015 21:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: UK
Contact:

Re: Help with json configuration file.

Post by Dave21w »

OK thanks, it's a shame especially as the ESP32 running OMG actually gets an rssi value imported to Domoticz as a sound level device as you can see,
MQTT Auto 78E36D0AEE20-rssi 1 SYS: Rssi General Sound Level -43 dB
Even the rssi value imported to a device like this would work fine as you only have to set a minimum level in a script to decide if it's present or not.
User avatar
waltervl
Posts: 5854
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Help with json configuration file.

Post by waltervl »

As said, I do not know what to expect. You are the first user to use these kind of devices with MQTT AutoDiscover.
So in the github issue describe what kind of Domoticz devices you would expect to be created from the BLE Tracker devices.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest