What I believe happens is that Domoticx publishes messages in a couple of selectable formats but always publishes all devices under one umbrella topic with the particular device identified by an idx key value within the json payload. What this results in as a consumer of such payloads is that I have to subscribe to this topic which updates for every Domoticz device and I have to examine and extract the json payloads and within that the idx key value to determine if I am even interested in 'this' device. This is totally inpractical as it consumes resources when I may not be even interested in the device update.
What I think should be considered is to include the idx within one of the topic hierarchies such that many different topics now become generated by Domoticz but a consumer can just choose to subscribe to specific ones of interest.
For example an existing topic might be
Code: Select all
domoticz/out/mqtt/mqttdevices = { json..., "idx"; 32, ...json }
Code: Select all
domoticz/out/mqtt/mqttdevices/32 = { json..., "idx"; 32, ...json }
Now instead of a listener subscribing to domoticz/out/mqtt/mqttdevices/# I can subscribe to
domoticz/out/mqtt/mqttdevices/32 and I will only receive updates for that specific device.
I can create multiple individual subscriptions for the devices I am interested in and now not get flooded by irrelevant messages
This will be backwards compatible with your domticz/in/.. handling as you can just subscribe to
Code: Select all
domoticz/in/*
Code: Select all
domoticz/in/#
Code: Select all
domoticz/in
Kevin