Page 3 of 6

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 15:48
by jvdz
Plugin? No idea what the relation is with a Plugin here.
You are using the Beta AutoDiscovery, this is an integration without the Plugin!
All CONFIG messages are send from your hardware gateway (ZIGBEE2MQTT/ZWAVEJS2MQTT...etc) to Mosquitto, the MQTT message daemon, and they are likely send with RETAINED=true. This means after they are send to the MQTT daemon, they will always be there and containing the latest information.
So in this case you have send the CONFIG messages to the wrong MQTT TOPIC previously, but they will be there until you manually remove them.
Just use the MQTT Explorer in windows to have a look at all message in the HOMEASSISTANT topic and delete all that aren't CONFIG messages:
This shows a correct message, where the last name in the TOPIC is CONFIG. Any other message should be deleted by clicking the BIN icon right-top or just hit the delete key when the topic is selected:
mqtt-explorer.png
mqtt-explorer.png (67.12 KiB) Viewed 3068 times

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 15:51
by rron
jvdz wrote: Friday 24 December 2021 15:48 Plugin? No idea what the relation is with a Plugin here.
You are using the Beta AutoDiscovery, this is an integration without the Plugin!
All CONFIG messages are send from your hardware gateway (ZIGBEE2MQTT/ZWAVEJS2MQTT...etc) to Mosquitto, the MQTT message daemon, and they are likely send with RETAINED=true. This means after they are send to the MQTT daemon, they will always be there and containing the latest information.
So in this case you have send the CONFIG messages to the wrong MQTT TOPIC previously, but they will be there until you manually remove them.
Just use the MQTT Explorer in windows to have a look at all message in the HOMEASSISTANT topic and delete all that aren't CONFIG messages:
This shows a correct message, where the last name in the TOPIC is CONFIG. Any other message should be deleted by clicking the BIN icon right-top or just hit the delete key when the topic is selected:

mqtt-explorer.png
Ok thanks, I will try this and let you know. Thanks for your help.

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 21:16
by mark.sellwood
I've finally cracked it.
I had the MQTT Prefix & Home Assistant Discovery Prefix set the same, changing them to the following fixed it:-

MQTT Prefix - Zwave_Messages
Home Assistant Discovery Prefix - Zwave_Discovery

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 22:30
by jvdz
What is the reason you all seem to have the desire to change the defaults set by all these components? :D
They all have "homeassistant" as the default discovery which is fine for starters, but indeed the essence is to use the same prefixes or else Domoticz won't listen to the correct topic for the Devices configs. .... and be especially careful not changing the STATE update topic to the TOPIC used for discovery because that gives all these error messages as we have seen in this thread!.

Maybe this is something that needs to be more explained in the Wiki?

Either way... Merry Christmas to all,
Jos

** moved to new sub forum **

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 23:12
by waltervl
I updated the zigbee2mqtt page as much as possible https://www.domoticz.com/wiki/Zigbee2MQ ... todiscover

The Zwavejs2mqtt page I did not change yet due to a lack of a good examples and less documentation on the Zwavejs2mqtt website.

Re: MQTT Audo-discovery

Posted: Friday 24 December 2021 23:46
by jvdz
Thanks, but why do we "strongly advice" to change the discovery topic in the wiki?
I would strongly advice to only change the defaults when one truly understands how things work.
Also would advice to only use multiple MQTT Hardware in Domoticz, when one understands the whole process, as that indeed will require different discovery TOPICS.

Re: MQTT Audo-discovery

Posted: Saturday 25 December 2021 14:17
by waltervl
The strong advice is only when you use multiple mqtt gateways (eg zigbee2mqtt and Zwavejs2mqtt) on the same time.

Re: MQTT Audo-discovery

Posted: Saturday 25 December 2021 21:15
by mark.sellwood
I changed the discovery topic as I'm using both zigbee2mqtt and Zwavejs2mqtt

Re: MQTT Audo-discovery

Posted: Saturday 25 December 2021 22:07
by jvdz
I have used both testing with zwavejs2mqtt; zigbee2mqtt; tasmota; milight-espgateway; esphome...
1. just one domoticz mqtt hardware with discovery topic homeassistant for all gateways I
2. having separate mqtt hardware for each gateway in domoticz.
Agree that separating has its advantages, especially organizing the devices per gateway, but each needs a unique discovery topic which also needs to configured in the appropriate gateway. You also want to disable the domoticz in/out topics in the extra mqtt hardware by leaving those fields empty.

Re: MQTT Audo-discovery

Posted: Saturday 25 December 2021 23:53
by waltervl
Yes, please have someone with a wiki account and Zwavejs2mqtt modify the Zwavejs2mqtt page if the information should be improved. I am happy to do so if someone delivers me the text and some good screenshots.

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 10:34
by jvdz
Agree and we might even want to separate it from the zigbee2mqtt part as this is much more than just that gateway. I see AutoDiscovery is also partly described in the MQTT Hardware page: https://www.domoticz.com/wiki/MQTT#Add_ ... Gateway.22
Maybe that is a better place to go into the details of AutoDiscovery?

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 11:41
by waltervl
My thoughts: There is a Zwavejs2mqtt and a zigbee2mqtt page on the wiki. So for people using that particular gateway should have a good description how to add the hardware gateway on Domoticz including some tips what should be the way if they have more Autodiscover gateways. The mqtt page should be as global as possible and should refer to the particular gateway if available.

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 13:10
by McMelloW
waltervl wrote: Sunday 26 December 2021 11:41 My thoughts: There is a Zwavejs2mqtt and a zigbee2mqtt page on the wiki. So for people using that particular gateway should have a good description how to add the hardware gateway on Domoticz including some tips what should be the way if they have more Autodiscover gateways. The mqtt page should be as global as possible and should refer to the particular gateway if available.
Makes thing more complicated. perhaps have it all on the MQTT hardware page and put links on all xxx2mqtt pages to the MQTT hardware page.

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 13:15
by rron
jvdz wrote: Friday 24 December 2021 22:30 What is the reason you all seem to have the desire to change the defaults set by all these components? :D
They all have "homeassistant" as the default discovery which is fine for starters, but indeed the essence is to use the same prefixes or else Domoticz won't listen to the correct topic for the Devices configs. .... and be especially careful not changing the STATE update topic to the TOPIC used for discovery because that gives all these error messages as we have seen in this thread!.

Maybe this is something that needs to be more explained in the Wiki?

Either way... Merry Christmas to all,
Jos

** moved to new sub forum **
Itś working without the errors now! I did a complete new installation on my test system and changed no settings, only the host url and that did the Job. Thanks for the help.

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 15:25
by waltervl
McMelloW wrote: Sunday 26 December 2021 13:10
waltervl wrote: Sunday 26 December 2021 11:41 My thoughts: There is a Zwavejs2mqtt and a zigbee2mqtt page on the wiki. So for people using that particular gateway should have a good description how to add the hardware gateway on Domoticz including some tips what should be the way if they have more Autodiscover gateways. The mqtt page should be as global as possible and should refer to the particular gateway if available.
Makes thing more complicated. perhaps have it all on the MQTT hardware page and put links on all xxx2mqtt pages to the MQTT hardware page.
The thing is that every xx2mqtt implementation needs its own instructions to install. Better to have seperate pages as Domoticz mqtt autodiscover is only a small part of the total instruction set. Needed for the first time users. Also needed for users who want to step over from zigbee2mqtt plugin or native OZW integration.

There are already references from the mqtt wiki to the xx2mqtt gateways.

Re: MQTT Audo-discovery

Posted: Sunday 26 December 2021 15:43
by EddyG
Just my 2 cents. Less is more/better. A wiki is mostly not for advanced users. So keep it simple and very clear.
A link in the Domoticz Wiki to Home Assistant MQTT Discovery might be confusing.
Text like:

Code: Select all

If enabled leave Prefex Topic in and Out empty.
should be:

Code: Select all

If enabled leave Topic In Prefix: and Topic Out Prefix: empty.
because that is the exact text in Domoticz itself, and that is easier for the starting user.

Re: MQTT Audo-discovery

Posted: Thursday 27 January 2022 15:23
by besix
Hello, adding devices works perfectly for me domoticz ver beta (build 14112). I have a question where the plug stores information about the device? I want to remove the sonoff r3 module from tasmota, after disconnecting the module and removing all devices, for this sonoff after updating the autodiscovery hardware everything comes back and the module is without power.
Below is a log with a disconnected module, it cannot send the status

Code: Select all

2022-01-27 15:04:55.916 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY TotalStartTime (unique_id: C896C0_ENERGY_TotalStartTime)
2022-01-27 15:04:56.019 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Total 1 (unique_id: C896C0_ENERGY_Total_1)
2022-01-27 15:04:56.120 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Total 2 (unique_id: C896C0_ENERGY_Total_2)
2022-01-27 15:04:56.222 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Yesterday 1 (unique_id: C896C0_ENERGY_Yesterday_1)
2022-01-27 15:04:56.323 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Yesterday 2 (unique_id: C896C0_ENERGY_Yesterday_2)
2022-01-27 15:04:56.425 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Today 1 (unique_id: C896C0_ENERGY_Today_1)
2022-01-27 15:04:56.526 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Today 2 (unique_id: C896C0_ENERGY_Today_2)
2022-01-27 15:04:56.627 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Power 1 (unique_id: C896C0_ENERGY_Power_1)
2022-01-27 15:04:56.729 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Power 2 (unique_id: C896C0_ENERGY_Power_2)
2022-01-27 15:04:56.830 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY ApparentPower 1 (unique_id: C896C0_ENERGY_ApparentPower_1)
2022-01-27 15:04:56.932 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY ApparentPower 2 (unique_id: C896C0_ENERGY_ApparentPower_2)
2022-01-27 15:04:57.033 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY ReactivePower 1 (unique_id: C896C0_ENERGY_ReactivePower_1)
2022-01-27 15:04:57.135 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY ReactivePower 2 (unique_id: C896C0_ENERGY_ReactivePower_2)
2022-01-27 15:04:57.236 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Factor 1 (unique_id: C896C0_ENERGY_Factor_1)
2022-01-27 15:04:57.338 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Factor 2 (unique_id: C896C0_ENERGY_Factor_2)
2022-01-27 15:04:57.439 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Voltage (unique_id: C896C0_ENERGY_Voltage)
2022-01-27 15:04:57.541 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Current 1 (unique_id: C896C0_ENERGY_Current_1)
2022-01-27 15:04:57.642 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY Current 2 (unique_id: C896C0_ENERGY_Current_2)
2022-01-27 15:04:57.744 Status: AUTO MQTT: discovered: C896C0/Ogród ENERGY BL09XX Temperature (unique_id: C896C0_ENERGY_BL09XX_Temperat)
2022-01-27 15:04:57.845 Status: AUTO MQTT: discovered: C896C0/Ogród ESP32 Temperature (unique_id: C896C0_ESP32_Temperature)
2022-01-27 15:04:57.946 Status: AUTO MQTT: discovered: Ogród/Ogród status (unique_id: C896C0_status)

Re: MQTT Audo-discovery

Posted: Thursday 27 January 2022 17:47
by waltervl
The MQTT broker (eg Mosquitto) stores these devices if you had retained messages switched on in Tasmota.
To get rid of those retained messages in MQTT broker see https://www.domoticz.com/wiki/MQTT#Dele ... ined_topic

Re: MQTT Audo-discovery

Posted: Thursday 27 January 2022 19:46
by besix
Thank you, it was a good direction.
Additionally, restart mosqutto after removing retained messages

Re: MQTT Audo-discovery

Posted: Thursday 27 January 2022 19:50
by jvdz
You also need to restart Domoticz to clear its INTERNAL HA AD devices table, as that is build when the config MQTT message are received and not clear until a restart of Domoticz.