I am a bit confused by the information I can find on MQTT Auto-discovery. If I understand correctly, autodiscovery is now natively supported by Domoticz. However I can't seem to get it going.
I tries to manually add a device using some example code I found somewhere.
siklosi wrote: ↑Friday 03 December 2021 10:09
When we are on the topic... what is correct procedure to reinitialize autodiscovery from z2m or domoticz in case when device was added to z2m but accept new hardware devices on domoticz was not enabled (aside from enabling accept new hardware devices )?
I would expect a trigger from the device (or perhaps some action in Z2M UI) would trigger a device creation in Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Perhaps a restart of the Domoticz MQTT gateway by clicking on the UPDATE button when selecting the MQTT Hardware from menu Setup - Hardware?
If you do not change anything on the hardware configuration the hardware will just restart after clicking on Update (not ADD! )
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
siklosi wrote: ↑Friday 03 December 2021 10:09
When we are on the topic... what is correct procedure to reinitialize autodiscovery from z2m or domoticz in case when device was added to z2m but accept new hardware devices on domoticz was not enabled (aside from enabling accept new hardware devices )?
This depends on your setitngs in zigbee/zwave2mqtt: in both cases you can specify whether to retain autodiscovery messages. If you do so, the last autodiscovery message is always kept bu the broker. Whenever you restart the hardware in domoticz, it will reload these and create missing devices if you accept new devices. The downside is that deleting devices requires you to manually delete these autodiscovery messages as well as, otherwise, already deleted devices will continue to be recreated.
You can also NOT retain these messages in which case restarting zwavejs/zigbee2mqtt will resend these autodiscovery messages on start. Typically, saving settings in zigbee2mqtt also does that.
I run both on my pi4 where I created a udev rule to restart the docker instance whenever the controller is removed/added. My aeotec gen5 stick is the one that does not work well with a pi4 reboot so I need to put a hub in between that hub occasionally disconnects/reconnects causing the docker instance to get stuck. The udev rule circumvents that by cathing the connect and restarting the docker instance when it does. It also then re-sends the autodiscovery messages.
So, multiple ways .
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
siklosi wrote: ↑Friday 03 December 2021 10:09
When we are on the topic... what is correct procedure to reinitialize autodiscovery from z2m or domoticz in case when device was added to z2m but accept new hardware devices on domoticz was not enabled (aside from enabling accept new hardware devices )?
This depends on your setitngs in zigbee/zwave2mqtt: in both cases you can specify whether to retain autodiscovery messages. If you do so, the last autodiscovery message is always kept bu the broker. Whenever you restart the hardware in domoticz, it will reload these and create missing devices if you accept new devices. The downside is that deleting devices requires you to manually delete these autodiscovery messages as well as, otherwise, already deleted devices will continue to be recreated.
You can also NOT retain these messages in which case restarting zwavejs/zigbee2mqtt will resend these autodiscovery messages on start. Typically, saving settings in zigbee2mqtt also does that.
siklosi wrote: ↑Friday 03 December 2021 10:09
When we are on the topic... what is correct procedure to reinitialize autodiscovery from z2m or domoticz in case when device was added to z2m but accept new hardware devices on domoticz was not enabled (aside from enabling accept new hardware devices )?
This depends on your setitngs in zigbee/zwave2mqtt: in both cases you can specify whether to retain autodiscovery messages. If you do so, the last autodiscovery message is always kept bu the broker. Whenever you restart the hardware in domoticz, it will reload these and create missing devices if you accept new devices. The downside is that deleting devices requires you to manually delete these autodiscovery messages as well as, otherwise, already deleted devices will continue to be recreated.
You can also NOT retain these messages in which case restarting zwavejs/zigbee2mqtt will resend these autodiscovery messages on start. Typically, saving settings in zigbee2mqtt also does that.
What a coincidence, I',m also trying out the auto-discovery thing of MQTT integrated in Domoticz. It is working, but when the device sending the config item restarts, new devices are created. This is what I send:
homeassistant/switch/esp_blinds/Mqnas/config/': { "name": "Blind_1_Mqnas", "cmd_t" : "~/set", "stat_t" : "~/state" }
homeassistant/switch/esp_blinds/Mqnas/config/': { "name": "Blind_2_Mqnas", "cmd_t" : "~/set", "stat_t" : "~/state" }
The devices are created (2 switches named Blind_X_Mqnas), but the second start, a second pair of devices is created. They all have different ID values, but these seem to be auto-generated, not sent by me...
Any idea how to prevent this? Or is this just because it's still in beta?
Thanks Jos! That was it! I already thought about the unique_id, but thought it needed to be in the /xx/xx/ path, not as an json item! It's working now!
I know the Domoticz Auto-discovery is Beta, but is it working at least to a basic level? I can (as seen above) now succesfully add switches automatically, but when I try to turn them on from Domoticz, I get the following error:
Mosq: MQTT_Discovery: Invalid/Unhandled data received! (Topic: switch/Blind_1_Mqnas/set, Message: ON)
Mosq: my MQTT server
This is now my config topic:
homeassistant/switch/Blind_1_Mqnas/config': { "name":"Blind_1_Mqnas", "uniq_id":"Blind_1_Mqnas", "cmd_t":"homeassistant/switch/Blind_1_Mqnas/set", "stat_t":"homeassistant/switch/Blind_1_Mqnas/state" }
Think the issue here is that you are using the HA discovery topic to send a status update which isn't supported.
So change your t_cmd to something else than homeassistant/*
eg:
I' have the same problem but I don understand this solution. Can you explane where I change this?
Ronald
jvdz wrote: ↑Friday 10 December 2021 13:49
Think the issue here is that you are using the HA discovery topic to send a status update which isn't supported.
So change your t_cmd to something else than homeassistant/*
eg:
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 18/38/0/currentValue, Message: {"time":1640003037730,"value":99,"nodeName":"Wasmachine","nodeLocation":"Zolder"})
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Something other then 'config' received on discovery topic! (23/38/1/currentValue/{"time":1639954365610,"value":0,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})!
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 23/38/1/currentValue, Message: {"time":1639954365610,"value":0,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})
2021-12-20 14:26:09.738 Error: MQTT: MQTT_Discovery: Something other then 'config' received on discovery topic! (23/38/2/currentValue/{"time":1639821438142,"value":99,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})!
2021-12-20 14:26:09.738 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 23/38/2/currentValue, Message: {"time":1639821438142,"value":99,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})
No this looks different. You are getting updates for discovered devices that cause an error.
Can you share the CONFIG MQTT message for these devices so I can check?
Also: What is your MQTT discovery topic in Domoticz?
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 18/38/0/currentValue, Message: {"time":1640003037730,"value":99,"nodeName":"Wasmachine","nodeLocation":"Zolder"})
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Something other then 'config' received on discovery topic! (23/38/1/currentValue/{"time":1639954365610,"value":0,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})!
2021-12-20 14:26:09.637 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 23/38/1/currentValue, Message: {"time":1639954365610,"value":0,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})
2021-12-20 14:26:09.738 Error: MQTT: MQTT_Discovery: Something other then 'config' received on discovery topic! (23/38/2/currentValue/{"time":1639821438142,"value":99,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})!
2021-12-20 14:26:09.738 Error: MQTT: MQTT_Discovery: Invalid/Unhandled data received! (Topic: 23/38/2/currentValue, Message: {"time":1639821438142,"value":99,"nodeName":"Kamer dimmer","nodeLocation":"Huiskamer"})
No this looks different. You are getting updates for discovered devices that cause an error.
Can you share the CONFIG MQTT message for these devices so I can check?
Also: What is your MQTT discovery topic in Domoticz?
You have to help me out, just started this. You are meaning this?
Schermafdruk van 2021-12-20 17-20-51.png (130.03 KiB) Viewed 5958 times
Attachments
Schermafdruk van 2021-12-20 17-25-49.png (202.81 KiB) Viewed 5957 times
You need to set the prefix the same at both sides, so change the domoticz prefix in ZWAVEJS2MQTT to homeassistant as well when that is what you have defined in domoticz/mqtt.
That topic prefix is used to exchange the device CONFIG topics & payload for auto discovery!