MQTT request domoticz

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jongerenchaos
Normal user
Posts: 11
Joined: 21 Jan 2016, 22:28

MQTT request domoticz

#1 Post by jongerenchaos » 23 Feb 2016, 11:15

For now it is not possible to do something with received commands from domoticz with MQTT connection. I have a suggestion how we can make this work.

Every IDX in domoticz is auto generated and can't be generate manualy. Therefore maybe it is a solution to add this IDX/Variable to the devices list and select one of the ports (which we use this normally as sensor output port) and deselect the send data (in ESPEASY).

When a incoming MQTT message is detected the IDX is sought in de database and select the corresponding port.After that the port can accept the command.

Martinus

Re: MQTT request domoticz

#2 Post by Martinus » 23 Feb 2016, 16:11

jongerenchaos wrote:For now it is not possible to do something with received commands from domoticz with MQTT connection. I have a suggestion how we can make this work.

Every IDX in domoticz is auto generated and can't be generate manualy. Therefore maybe it is a solution to add this IDX/Variable to the devices list and select one of the ports (which we use this normally as sensor output port) and deselect the send data (in ESPEASY).

When a incoming MQTT message is detected the IDX is sought in de database and select the corresponding port.After that the port can accept the command.
I thought every Domoticz user uses the HTTP protocol so you may be the first one asking. Since no one has cried real tears because of this, I've just been to lazy to work on that protocol.

You're right that we need at least some output device to have the option to set an IDX and corresponding GPIO.
I will see if the next development build can have at least the option to switch a build-in GPIO.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT request domoticz

#3 Post by tozett » 23 Feb 2016, 22:35

Martinus wrote: You're right that we need at least some output device to have the option to set an IDX and corresponding GPIO.
I will see if the next development build can have at least the option to switch a build-in GPIO.
+1 ! via MQTT :P

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: MQTT request domoticz

#4 Post by Deennoo » 23 Feb 2016, 22:46

+1 can be away to send IR command

jongerenchaos
Normal user
Posts: 11
Joined: 21 Jan 2016, 22:28

Re: MQTT request domoticz

#5 Post by jongerenchaos » 24 Feb 2016, 13:38

Thanks!

The http protocol is much much slower than the MQTT protocol incombo with domoticz.
Currently i use a switch (input) and relais (output). When i push the switch button first a MQTT message goes to domoticz after that domoticz send a http command back. It takes sometimes 0.5sec / 1 sec to put the relais on/off. After some tests the last HTTP command is the slowest one in this proces.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT request domoticz

#6 Post by tozett » 24 Feb 2016, 13:48

+1 ! via MQTT :D

jongerenchaos
Normal user
Posts: 11
Joined: 21 Jan 2016, 22:28

Re: MQTT request domoticz

#7 Post by jongerenchaos » 01 Mar 2016, 16:41

Thanks for implementing this feature!

There is only one issue; when you create a output in domoticz (for example IDX 222) and add this as a outgoing device to esp8266 with the 222 idx. The esp accept this command and put the light on/off when you send a command from the domoticz system.

But when i try to add also a switch device (outgoing) on the devices tab from the esp to domoticz with the same IDX (as switch device). The esp accept it and try to do the same with this outgoing output and you get a loop.

The solution is to add: if (Settings.TaskDeviceSendData == 0) and accept only the devices who send nothing back to the domoticz system.

Can you add this?

Martinus

Re: MQTT request domoticz

#8 Post by Martinus » 01 Mar 2016, 17:49

jongerenchaos wrote:Thanks for implementing this feature!

There is only one issue; when you create a output in domoticz (for example IDX 222) and add this as a outgoing device to esp8266 with the 222 idx. The esp accept this command and put the light on/off when you send a command from the domoticz system.

But when i try to add also a switch device (outgoing) on the devices tab from the esp to domoticz with the same IDX (as switch device). The esp accept it and try to do the same with this outgoing output and you get a loop.

The solution is to add: if (Settings.TaskDeviceSendData == 0) and accept only the devices who send nothing back to the domoticz system.

Can you add this?
I need to be able to reproduce the bug first otherwise I can't test the fix. I have done this setup with a push button switch. I can control the LED on GPIO-16 with the pushbutton on the Node-MCU. Can also control the LED from Domoticz and the state keeps in sync between Domoticz and ESP. No loop detected here.
Domoticz_MQTT_setup1.png
Domoticz_MQTT_setup1.png (10.36 KiB) Viewed 12488 times

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT request domoticz

#9 Post by tozett » 02 Mar 2016, 20:51

i cannot find the right place in the forum anymore,
but there had been some difficuties with connection the easpeasy to different broker.
if found some slight difference between ver 3.1 and 3.1.1 brokers today here:

https://github.com/mqtt/mqtt.github.io/ ... -and-3.1.1

http://www.hivemq.com/blog/6-facts-why- ... mqtt-3-1-1

but that is a total difference for some pubsub-clients
AND

as the MQTT cmd-features are improving, maybe one should stress this difference directly on the wiki(!?)
to save some espeasy newbies from searching the forum for 'false-positive' bugs. maybe? :shock:

jongerenchaos
Normal user
Posts: 11
Joined: 21 Jan 2016, 22:28

Re: MQTT request domoticz

#10 Post by jongerenchaos » 03 Mar 2016, 13:58

@Martinus

You're right! It works without any problems. I only check the sourcecode before i try it :( my fault... Excuse me!

I change action = F("gpio,"); to action = F("pcfgpio,"); and it works well!

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT request domoticz

#11 Post by tozett » 03 Mar 2016, 17:25

i guess, we are SOLVED (somehow) :P

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests