Page 1 of 1

MQTT Auto Discovery on Synology NAS

Posted: Friday 05 August 2022 18:30
by mvveelen
Hi,

I'm a bit lost. I think.

I have Domoticz running in Docker on a Synology NAS and MQTT installed as a package. I got it working with this combination, not with MQTT in Docker. But if it works, then it's OK.

There is only 1 thing I wonder. When removing one of the attached peripherals of the NAS (USB) and reattaching them, the Sonoff switches stop working and there are new Sonoff switches discovered with new ID's, all with the same name but double. I can keep doing this and every time new devices are discovered with new ID's.

Ofcourse I would like to stop this, but how?

Not sure if I have the setup correct, but I installed both MQTT hardware 'devices' I found (nothing else for MQTT) and this is the setup:

MQTT Client Gateway with LAN interface:
Remote Address: IP NAS
Port: 1883
Username: empty
Password: empty
Prevent Loop: True
Publish Topic: Flat
Topic in Prefix: domoticz/in
Topic Out Prefix: domoticz/out
CA Filename: empty
TLS Version: tlsv1.2

MQTT Auto Discovery Client Gateway with LAN interface
Remote Address: IP NAS
Port: 1883
Username: empty
Password: empty
Auto Discovery Prefix: homeassistant
CA Filename: empty
TLS Version: tlsv1.2

The Sonoff's have the following settings for MQTT:
Host: IP NAS
Port: 1883
Client: DVES_%06X
User: empty
Password: empty
Topic: sonofxx (I use different numbers for each Sonoff)
Full Topic: %topic%/%prefix%/

When I enter SetOption19 1 in the Sonoff console (one by one), the new devices are discovered when deleting all switches from Domoticz first.

Re: MQTT Auto Discovery on Synology NAS

Posted: Sunday 07 August 2022 10:15
by mvveelen
Suddenly, without restarting Domoticz or any of the MQTT hardware in Domoticz, all switches were 'doubled' and so there were 12. That kept working for a day, but yesterday none of them could be reached by switching on/off and I had to delete them and go to each Sonoff to enter SetOption19 1 to let them be discovered again.

This isn't the way it's supposed to work, what am I doing wrong?

Re: MQTT Auto Discovery on Synology NAS

Posted: Tuesday 08 November 2022 15:55
by arma_esiea
I have the same config, do you stop one of the two MQTT Client Gateway ?

Re: MQTT Auto Discovery on Synology NAS

Posted: Tuesday 22 November 2022 9:35
by mvveelen
No I didn't. But when I restart the Syno I have to delete the discovered devices and run SetOption19 1 on every Sonoff to let them be rediscovered. Maybe I'm doing something wrong, but I don't know what.

Re: MQTT Auto Discovery on Synology NAS

Posted: Wednesday 14 December 2022 16:03
by waltervl
Looks like a problem with Sonoff devices flashed with Tasmota. It seems that tasmota suddenly starts to send messages with new ID's. Or due to the resetsetoption 19?
Did you switch on retain MQTT message?

Re: MQTT Auto Discovery on Synology NAS

Posted: Wednesday 14 December 2022 17:04
by mvveelen
I haven't changed anything on the Sonoff's and this is what I did when I flashed them with Tasmota:

SetOption19 1

It worked for years on a DS414 (Jadahl package) but on the DS920+ in Docker, after restarting the Syno, it shows me new devices. Sometimes even without restarting the Syno so it seems.

And, the other problem is that the USB devices (RFXcom and P1 cable) aren't recognised so I have to reinstall the drivers (Jadahl) after every reboot and change the settings in Domoticz.

Edit: the Sonoff's are running on Tasmota 6.3.0, is that the problem maybe?
If so, I can update them but the setup is at my in-laws house and I don't want to break things from here.

Edit 2: I broke one of the Sonoff's in the last step. Updated to the minimal versions of v7, v8, v9 and v12: success. Full version v12.2.0 : can't reach him anymore so I'll have to flash this one again :oops:

Re: MQTT Auto Discovery on Synology NAS

Posted: Wednesday 14 December 2022 18:46
by waltervl
What version of Domoticz are you running in your docker? As mqtt Autodiscover is not that old in Domoticz I suspect you switched from a plugin to Mqtt Autodiscover.

There is still some plugins available for tasmota as MQTT Autodiscover is removed from the latest Tasmota firmwares. So for newer tasmotas you need the plugin. See the tasmota documentation: https://tasmota.github.io/docs/Domoticz/

Re: MQTT Auto Discovery on Synology NAS

Posted: Wednesday 14 December 2022 19:23
by mvveelen
2022.1 (build 14438)

I'll have to find out how it works with plugins in Docker. I'm already familiar with this new plugin for my own setup (Rpi).

Re: MQTT Auto Discovery on Synology NAS

Posted: Wednesday 14 December 2022 20:25
by waltervl

Re: MQTT Auto Discovery on Synology NAS

Posted: Saturday 17 December 2022 14:59
by mvveelen
As my father in law only uses 5 Sonoff's, I decided to make 5 Dummy switches and switch the Sonoff's with the On/Off URL in the On/Off actions of the switches. Works fine.

Now I only would like to see a solution for the USB devices, like the RFXcom and the P1 cable to be working after restarting the Synology. Now I have to reinstall the drivers and select the right port for the 2 devices. If anyone knows a solution for this, I'd be happy to try it.

Re: MQTT Auto Discovery on Synology NAS

Posted: Saturday 17 December 2022 17:58
by waltervl
Did you check the synology page on the wiki https://www.domoticz.com/wiki/Synology

Re: MQTT Auto Discovery on Synology NAS

Posted: Saturday 17 December 2022 18:36
by mvveelen
Yes, and I managed to get it working but with another code which is ran after a reboot. So all's well atm.