It took me some time to get there but with the patient help of Gizmocuz here's the explanation:
Domoticz expects the autodiscovery topic to be published in the folder "homeassistant/....
and
the state payload in a folder like zwavejs2mqtt/... or zigbee2mqtt/... or tasmota/... or myhardware/...
The idea being to keep separate autodiscovery and state information.
So taking the HA examples previously used they should look like this:
Switch:
config:
Code: Select all
mosquitto_pub -r -h 127.0.0.1 -p 1883 -t homeassistant/binary_sensor/garden/config" -m '{"name": "garden", "device_class": "motion", "state_topic": "myhardware/binary_sensor/garden/state"}'
state:
Code: Select all
mosquitto_pub -h 127.0.0.1 -p 1883 -t "myhardware/binary_sensor/garden/state" -m ON
same thing for the temperature and humidity.
If you want Domoticz to create a single temp/humidity device then you need to add a device descriptor to of the the config payloads as shown in the HA example, e.g.
"device": { "identifiers": [ "myhardware_1234" ], "manufacturer": "ME", "model": "Temperature and humidity sensor", "name": "Bedroom" },
If you don't add this then Domoticz will create independant temperature and humidity devices.
You should also add a "unique_id" field otherwise at each restart Domoticz (may) think this is a new device!
Domoticz says these sensors are discovered but treats them differently, the switch device is created immediately but the temperature/humidity devices only on first reception of the state information!
I was confused at first because I expected Ha and Domoticz to react in the same way, they don't. Using the HA examples as is in HA works as expected but not in Domoticz where the interpretation/representation is different.
Hope this helps someone.
Chris aka Redswan