Guide: Setting up and testing MQTT Client Gateway
-
Well i had to move all the libs from production branch and extract clean only the development branch in arduino IDE to get it to work.
Afterwards had to do the same thing back to production to compile the humidity sensor as it gave me the following error during compilationArduino: 1.6.5 (Windows 7), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)" In file included from Mysensors_DHT_Wireless.ino:31:0: \My Documents\Arduino\libraries\MySensors/MySensor.h:201:3: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless. #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless. ^ Mysensors_DHT_Wireless:39: error: 'MySensor' does not name a type Mysensors_DHT_Wireless.ino: In function 'void setup()': Mysensors_DHT_Wireless:50: error: 'gw' was not declared in this scope Mysensors_DHT_Wireless.ino: In function 'void loop()': Mysensors_DHT_Wireless:75: error: 'gw' was not declared in this scope Mysensors_DHT_Wireless:85: error: 'gw' was not declared in this scope Mysensors_DHT_Wireless:90: error: 'gw' was not declared in this scope 'MySensor' does not name a type -
Is there some miscompatability betweed development/production branches?
My humidity sensor reports in the serial console just fine.
req id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok: req id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok: T: 24.60 req id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok: H: 87.00On the gateway i see the following
0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0: 0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3 0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0: 0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3 0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0: 0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3But in mosquitto...
mygateway1-out/255/255/3/0/3 (null) mygateway1-out/255/255/3/0/3 (null) mygateway1-out/255/255/3/0/3 (null) -
Please ignore the last post. Solved by finding out that Openhab doesn't handle Node ID assigning.
-
Hi,
Just tried to set up an ESP-12E as MQTT gateway and noticed one bug in the actual development branch:
As soon as one of the three LED PIN assignments is not defined (commented out), the Example sketch will lock itself after initializing NRF radio, and running DHCP. So, no further NRF communication nor signup at the broker. WDT steps in then.Just defining all three LEDs, without any other parameter or use the LED blinking feature, and everything is fine.
-
Im lost...
Ive just setup a new MQTT client gateway ( from link at the top of this post..) and have a few nodes successfully sending data to a mosquito server.
What im trying to now do is, using the RelayActuator sketch, is control the relay via a MQTT message...but im confused as to what i need to send it!
Here is the serial output from the RelayActuator sketch:
Starting repeater (RNNRA-, 2.0.0-beta) Radio init successful. send: 9-9-0-0 s=255,c=3,t=15,pt=1,l=1,sg=0,st=ok:0 send: 9-9-0-0 s=255,c=0,t=18,pt=0,l=10,sg=0,st=ok:2.0.0-beta send: 9-9-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0 send: 9-9-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay send: 9-9-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0 send: 9-9-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok: Init complete, id=9, parent=0, distance=1So what message do i send it from another MQTT client ?
ive been trying things such as mygateway1-in/9/0/1/1 with message of 0 or 1Pls help ! ;-)
-
mmm..perhaps there is a problem between mosquito and the mqttclient gateway. As ive now attached a serial monitor to the mqttclient gateway and sending the message doesnt appear in the console. I assume it should...
Opening port Port open 0;255;3;0;9;read: 9-9-0 s=255,c=3,t=15,pt=1,l=1,sg=0:0 0;255;3;0;9;Sending message on topic: mygateway1-out/9/255/3/0/15 0;255;3;0;9;read: 9-9-0 s=255,c=0,t=18,pt=0,l=10,sg=0:2.0.0-beta 0;255;3;0;9;Sending message on topic: mygateway1-out/9/255/0/0/18 0;255;3;0;9;read: 9-9-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0 0;255;3;0;9;Sending message on topic: mygateway1-out/9/255/3/0/6 0;255;3;0;9;read: 9-9-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay 0;255;3;0;9;Sending message on topic: mygateway1-out/9/255/3/0/11 0;255;3;0;9;read: 9-9-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0 0;255;3;0;9;Sending message on topic: mygateway1-out/9/255/3/0/12 0;255;3;0;9;read: 9-9-0 s=1,c=0,t=3,pt=0,l=0,sg=0: 0;255;3;0;9;Sending message on topic: mygateway1-out/9/1/0/0/3 0;255;3;0;9;read: 1-1-0 s=0,c=1,t=0,pt=7,l=5,sg=0:26.8 0;255;3;0;9;Sending message on topic: mygateway1-out/1/0/1/0/0 0;255;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:26.7 0;255;3;0;9;Sending message on topic: mygateway1-out/1/1/1/0/0as you can see no incoming messages from mosqutto.
-
I can see in mosquitto logs a subscription from the gateway
1452645694: mosquitto version 1.3.4 terminating 1452645694: Sending CONNACK to mysensors-1 (0) 1452645694: Received SUBSCRIBE from mysensors-1 1452645694: mygateway1-in/+/+/+/+/+ (QoS 0) 1452645694: Sending SUBACK to mysensors-1So looks like i need to add an extra level to the message i send!
So i just tried sending a message to topic:mygateway1-in/9/1/0/1/1
and now i can see in my serial outputs of both the mqttclient gateway and the relaysketch node the message received!
( but its not swithing my relay yet! )@hek is this the correct MQTT formatting:
MY_MQTT_PUBLISH_TOPIC_PREFIX/FROM-NODE-ID/SENSOR-ID/CMD-TYPE/ACK-FLAG/SUB-TYPE -
Ok got it... ( sorry for making mess of this discussion!)
If i publish to
mygateway1-in/9/1/1/0/2 and send message values of 0 or 1 it works.... ;-)Hope this helps someone else!
Greg ;-)
-
@hek
That thread does not directly touch on the issue I noticed, although that might be connected.Some other questions:
Why is the topic structure as it is? I like my MQTT topics in hierarchical order. So, having different prefixes for send and receive (in and out) is not nice, but ok. BUt why is the ACK flag before the data type, which is usually linked to a value or variable in the sensor? I would consider ACK to be a sub-value of that one.And is there a way to have more speaky names instead of numbers? So, the source does not have that option and as that gateway is now included in the library I only see the possibility of changing the source in the library, which will disconnect from updates. Not nice. What about an option of excluding gatewayTransportSend and incomingMQTT via define from the library and define then in the own sketch?
-
What is the correct way to run DHCP? Tried commenting out
#define MY_IP_ADDRESS
but that didn't help.Also is it possible to use fqdn for the mqtt broker instead of the ip?
-
What is the correct way to run DHCP? Tried commenting out
#define MY_IP_ADDRESS
but that didn't help.Also is it possible to use fqdn for the mqtt broker instead of the ip?
I also tried to use DHCP and fqdn for mosqitto, but no luck....so I cant help but I too would like to know if its possible.
-
Finally I have the ESP8266 gateway running with Mosquitto and Openhab. Because the ESP8266 Gateway installation was painless and Mosquitto and Openhab the major problems I have posted some general info at this link in case anyone is interested, see http://forum.mysensors.org/topic/3005/switching-from-v1-5-mqtt-gateway-to-esp8266-mqtt-client-gateway.
(Sorry if this is the wrong procedure but found no way to add other tags to a message in this thread). -
A PR was merged 5 days ago where you can specify
MY_CONTROLLER_URL_ADDRESShttps://github.com/mysensors/Arduino/pull/375
I haven't verified it myself yet though.
-
I have been successfully running the MQTT client gateway receiving the data from sensors. Now build the first mysensors relay and would like to know if the MQTT client gateway can act as a transmitter?
I have assigned the nod id of 55 to the relay sensor and trying to send
mosquitto_pub -t mygateway1-in/55/1/0/0/3 -m "1"But doesn't seem to help
-
Resolved. Power supply was the problem