Page 1 of 1

MQTT-AD config message with multiple devices support?

Posted: Monday 03 November 2025 11:34
by Domoberry
Hi all,
Busy again with MQTT-Auto Discovery. This time the source is https://github.com/tillsteinbach/CarCon ... eassistant. CarConnectivity is a solution to integrate car brands like VW, Skoda and more into a home automation system, it supports MQTT as well as MQTT-AD. I cannot get the Auto Discovery part to work with Domoticz. Here is an example of a Auto Discovery config message:

Code: Select all

Topic name: mqttad_id3/device/carconnectivity-carconnectivity-0/config
Payload:
{
    "device": {
        "ids": "carconnectivity-0",
        "name": "CarConnectivity",
        "mf": "Till Steinbach and the CarConnectivity Community",
        "sw": "0.7"
    },
    "origin": {
        "name": "CarConnectivity",
        "sw": "0.4",
        "url": "https://github.com/tillsteinbach/CarConnectivity"
    },
    "cmps": {
        "carconnectivity-0_volkswagen_healthy": {
            "p": "binary_sensor",
            "device_class": "running",
            "name": "Volkswagen Connector Healthy",
            "icon": "mdi:check",
            "state_topic": "carconnectivity/0/connectors/volkswagen/healthy",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_volkswagen_healthy",
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        },
        "carconnectivity-0_volkswagen_connection_state": {
            "p": "sensor",
            "device_class": "enum",
            "name": "Volkswagen Connector Connection State",
            "icon": "mdi:lan-connect",
            "state_topic": "carconnectivity/0/connectors/volkswagen/connection_state",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_volkswagen_connection_state",
            "options": [
                "disconnected",
                "connecting",
                "connected",
                "disconnecting",
                "error",
                "unknown connection state"
            ],
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        },
        "carconnectivity-0_mqtt_healthy": {
            "p": "binary_sensor",
            "device_class": "running",
            "name": "MQTT Plugin Healthy",
            "icon": "mdi:check",
            "state_topic": "carconnectivity/0/plugins/mqtt/healthy",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_mqtt_healthy",
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        },
        "carconnectivity-0_mqtt_connection_state": {
            "p": "sensor",
            "device_class": "enum",
            "name": "MQTT Plugin Connected",
            "icon": "mdi:lan-connect",
            "state_topic": "carconnectivity/0/plugins/mqtt/connection_state",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_mqtt_connection_state",
            "options": [
                "disconnected",
                "connecting",
                "connected",
                "disconnecting",
                "error",
                "unknown connection state"
            ],
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        },
        "carconnectivity-0_mqtt_homeassistant_healthy": {
            "p": "binary_sensor",
            "device_class": "running",
            "name": "MQTT Home Assistant Plugin Healthy",
            "icon": "mdi:check",
            "state_topic": "carconnectivity/0/plugins/mqtt_homeassistant/healthy",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_mqtt_homeassistant_healthy",
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        },
        "carconnectivity-0_webui_healthy": {
            "p": "binary_sensor",
            "device_class": "running",
            "name": "WebUI Plugin Healthy",
            "icon": "mdi:check",
            "state_topic": "carconnectivity/0/plugins/webui/healthy",
            "payload_off": "False",
            "payload_on": "True",
            "unique_id": "carconnectivity-0_webui_healthy",
            "availability": [
                {
                    "topic": "carconnectivity/0/plugins/mqtt/connection_state",
                    "payload_not_available": "disconnected",
                    "payload_available": "connected"
                }
            ]
        }
    }
}
Note: I have set the Domoticz MQTT-AD prefix to mqttad_id3.
I tried both publishing this message with retained on and off, neither works.
I would expect some notification in the Domoticz log, and ultimately the created devices.
So far, no response seen in the log
However, if I change the component type in the topic name from 'device' to 'binary_sensor' (this is a random choice), there is a reaction visible in the log. No devices are created, but that is likely due to the fact that the payload does not properly reflect 'binary_sensor'.
Yet before digging further my ask:
As I understood (I could be wrong...) component type 'device' in the config message topic-name is used for config messages dealing with multiple device definitions in one config message. This seems allowed as per the Home Assistant MQTT-AD documentation . CoPilot however tells me this is not (yet?) supported by the Domoticz MQTT-AD client. If so, I will abandon this track using MQTT-AD and instead use 'normal' MQTT and something like MQTT-Mapper or NodeRed to translate the CarConnectivity MQTT messages to a format suitable for Domoticz (and manually create the devices)
Anyone have more details on this?

Re: MQTT-AD config message with multiple devices support?

Posted: Monday 03 November 2025 19:50
by waltervl
As is written here: https://wiki.domoticz.com/MQTT#Add_hard ... Gateway%22
Device will be created only after the device sends data.
So after the config topic is received Domoticz waits until it receives sensor data/values for that device.

Domoticz MQTT AD is based on the implementation by Zigbee2mqtt and Zwave-js-UI. I have no idea of they do multiple device configs in one config payload.

Re: MQTT-AD config message with multiple devices support?

Posted: Tuesday 04 November 2025 11:03
by Domoberry
Thanks Waltevl for the reply. Please allow me some further queries for my understanding (and apologies for the long reply)
I'm aware that Domoticz Auto Discovery, after receiving the Auto Discovery config message, only creates the device after the first value has been received.
Yet, if only a correct config message is sent (no value yet), example:
(this config message is just an example I took from a working other Domoticz setup)

Code: Select all

topic: mqttad_id3/sensor/ems-esp2/boiler_ro_selflowtemp/config
payload:
{
  "uniq_id" : "boiler_ro_sel_flow_temperature",
  "obj_id" : "boiler_ro_sel_flow_temperature",
  "name" : "RO Selected flow temperature",
  "stat_t" : "ems-esp2/boiler_data",
  "val_tpl" : "{{value_json.selflowtemp if value_json.selflowtemp is defined else 0}}",
  "avty" : [ ],
  "unit_of_meas" : "C",
  "stat_cla" : "measurement",
  "dev_cla" : "temperature",
  "dev" : {
    "ids" : [ "ems-esp2-boiler" ],
    "name" : "ems-esp2 Boiler"
  }
}
(I did not send it as a retained message)
The Domoticz log shows:

Code: Select all

2025-11-04 09:46:10.289 Status: CarConnectivity MQTT-AD: Discovered: ems-esp2 Boiler (RO Selected flow temperature)/ems-esp2 Boiler (RO Selected flow temperature) (unique_id: boiler_ro_sel_flow_temperature)
At that point in time, no device is created yet, as expected.
As soon as I sent a value:

Code: Select all

topic: ems-esp2/boiler_data
payload: {"selflowtemp": 45.2}
the log shows:

Code: Select all

2025-11-04 10:08:19.514 CarConnectivity MQTT-AD: Temp/THR128/138, THC138 (ems-esp2 Boiler (RO Selected flow temperature))
and the corresponding device is created in Domoticz.

Hence, I assume that even without the first corresponding value sent, Domoticz responds in the log to an Auto Discovery config received.

Yet, a config message topic like:

Code: Select all

mqttad_id3/device/carconnectivity-carconnectivity-0/config
Does not result in any feedback in the log.
And indeed, I have not seen such 'multiple device' approach in Zwave-js-UI, there each device has a config message.

Trying to digest the information on Auto Discovery in https://www.home-assistant.io/integrati ... -discovery, I read that 'device' can be used in the config message topic name "in case of a device discovery" and a bit further "A device can send a discovery payload to expose all components for a device. The <component> part in the discovery topic must be set to <device>.". Is this perhaps something Domoticz does not support yet? Disclaimer: I'm absolutely not sure about this hypothesis, hence this post.

I’m trying to figure out if I should rather not use Auto Discovery in this CarConnectivity case, or perhaps raise a request to the CarConnectivity team to offer the Auto Discovery config messages as separate messages instead.

Re: MQTT-AD config message with multiple devices support?

Posted: Tuesday 04 November 2025 13:21
by waltervl
I dont think domoticz supports the multi config messages (yet) but expects separate config messages per node/device.
See also the source code: https://github.com/domoticz/domoticz/bl ... C22-L622C2

Edit: You can also modify the mqtt_homeasistant plugin of CarConnectivity so it published seperate config messages:
https://github.com/tillsteinbach/CarCon ... gin.py#L99

Re: MQTT-AD config message with multiple devices support?

Posted: Tuesday 04 November 2025 15:37
by gizmocuz
I read something about a migration to the new config system on the page you mentioned.

Domoticz does not support the 'device' config

"To allow a smooth migration from single component discovery to device-based discovery..."

Maybe the author could do the migration for you? Another option is to do them manually as I think it is pretty static.

Re: MQTT-AD config message with multiple devices support?

Posted: Tuesday 04 November 2025 16:22
by Domoberry
Thanks a lot for your feedback, seems clear to me now:
- there is no response in the log from a 'device' Auto Discovery config message as this type of config messages is not (yet) supported
- alternative is to split a 'device' Auto Discovery config message into separate config messages, since the config is indeed pretty static this would be a one time straight forward job. (which could also be implemented in the Carconnectiviy client plugin code)
- manual config messages furthermore allows selecting only those Domoticz devices for the parameters you are really interested in (there are 200+ available...)
- other alternative is to use the normal MQTT messages from CarConnectivty and convert them to Domoticz MQTT format using NodeRed or MQTT mapper