Reacting on MQTT message from Domoticz

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
nafremony
New user
Posts: 3
Joined: 06 Feb 2017, 11:18

Reacting on MQTT message from Domoticz

#1 Post by nafremony » 06 Feb 2017, 11:36

Hello, I have Domoticz set up with MQTT (Mosquitto) and I added simple switch. When I turn it on using /control?cmd=GPIO,5,1, I see it goes on in Domoticz. However when I turn it then off in Domoticz, I see the message in domoticz/out with correct idx and nvalue, but ESP seems to be ignoring that message doing nothing to the GPIO.

The switch is set as:
Image

I tried setting up the Output - (Domoticz MQTT helper), just trying blind luck:
Image
But that didn't help.

Is there a way to react on messages from Domoticz? Or do I have to use the HTTP action on ON/Off?

NietGiftig
Normal user
Posts: 103
Joined: 16 Sep 2015, 20:32

Re: Reacting on MQTT message from Domoticz

#2 Post by NietGiftig » 06 Feb 2017, 11:48

Is there a way to react on messages from Domoticz? Or do I have to use the HTTP action on ON/Off?
For simple on/off that's the most easy thing to do.

nafremony
New user
Posts: 3
Joined: 06 Feb 2017, 11:18

Re: Reacting on MQTT message from Domoticz

#3 Post by nafremony » 06 Feb 2017, 12:03

NietGiftig wrote: For simple on/off that's the most easy thing to do.
But do I have to? Or is there an other way?

ToniA
Normal user
Posts: 69
Joined: 26 Aug 2016, 20:37

Re: Reacting on MQTT message from Domoticz

#4 Post by ToniA » 06 Feb 2017, 12:12

It's the length of the Domoticz MQTT message. In my own branch I'm using PlatformIO to build ESPEasy, so that I can have global #define's in the ini file.

With Arduino IDE, you need to hardcode longer MQTT buffer support into pubsubclient and Controller.ino.

nafremony
New user
Posts: 3
Joined: 06 Feb 2017, 11:18

Re: Reacting on MQTT message from Domoticz

#5 Post by nafremony » 06 Feb 2017, 12:23

ToniA wrote:It's the length of the Domoticz MQTT message.
Ahh, thanks. Good to know.

I also found there's a chance of infinite loop, if two messages are published quickly after each other before Domoticz processes these:
  1. ESP: GPIO,5,1 (sends MQTT payload to Domoticz)
  2. ESP: GPIO,5,0 (sends MQTT payload to Domoticz)
  3. Domoticz responds in domoticz/out setting to ON, where ESP picks it up and turns it ON (step 2 turned it off) - so back to step 1.
  4. Domoticz responds in domoticz/out setting to OFF, where ESP picks it up and turns it OFF (previous step turned it on)
  5. ...
So I think I rather stick with Domoticz+HTTP.

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests