|
Post by selcouth on Mar 29, 2015 4:28:46 GMT
I'm using Computourist's Gateway 2.2 and DHT end node 2.1 and trying to turn an LED on and off via openHAB switch. Toggling the switch gives me a syntax error at the gateway and does nothing. I can toggle the LED on and off via 'l' in the gateway serial console.
DHT end node is node02.
openHAB item:
Switch LEDSWITCH "LED Switch" {mqtt=">[mymosquitto:home/rfm_gw/sb/node02/dev16:command:ON:ON],>[mymosquitto:home/rfm_gw/sb/node02/dev16:command:OFF:OFF]"} This is the debug info from the gateway:
Topic received from Mosquitto: home/rfm_gw/sb/node02/dev16
Value is: 0
Syntax error code is: 3
I added printing strPayload to serial console in the gateway code and have found it's always blank (blank line above "Value is: 0").
else if (strPayload != "READ") { mqttToSend = false; error = 3; Serial.println(strPayload); }
As a side note, I get the same gateway debug info when I try to use mosquitto_pub from the Pi. Am I not forming the message correctly?
mosquitto_pub -t "home/rfm_gw/sb/node02/dev16" -m "READ"
|
|
|
Post by computourist on Mar 30, 2015 8:49:12 GMT
I have the exact same item definition in Openhab and it's working OK for me.
Syntax error 3 means the message block doesn't not contain "ON", "OFF" or "READ" as valid instructions. The debugging info you provide suggests the message block is empty. It looks as if Openhab is not transferring the proper message contents. Do you maybe have a definition for a translation in the "transform" folder that messes things up ?
You can easily debug your MQTT messages by installing an MQTT client (like MQTT.fx) on a PC in the network and subscribing to topic:
home/rfm_gw/#
This will show all northbound and soutbound messages.
- Computourist
|
|
|
Post by selcouth on Mar 30, 2015 16:02:39 GMT
No, no transform/translation conflicts for openHAB.
Are you able to send a message from an external MQTT client and have the gateway read it? I get the same problem with mosquitto_pub so I'm thinking the message block is not getting parsed correctly from the payload. As I understand it, mosquitto_pub -t "home/rfm_gw/sb/node02/dev16" -m "READ" should give me the status of dev16.
|
|
|
Post by computourist on Mar 30, 2015 18:09:49 GMT
No, no transform/translation conflicts for openHAB. Are you able to send a message from an external MQTT client and have the gateway read it? I get the same problem with mosquitto_pub so I'm thinking the message block is not getting parsed correctly from the payload. As I understand it, mosquitto_pub -t "home/rfm_gw/sb/node02/dev16" -m "READ" should give me the status of dev16. Yes, when using an external client (in this case MQTT.fx) I get a proper result: As stated earlier: also when using Openhab I get expected results... I suggest you install MQTT.fx or another client to inspect the actual messages being exchanged. This will point you to the root of the problem.
|
|
|
Post by selcouth on Mar 30, 2015 19:24:33 GMT
Yea, I read you got expected results from openHAB, was just curious about an external client as well. I will subscribe to the wild card topic this evening and see if I get some more information. Thanks.
|
|
|
Post by selcouth on Mar 30, 2015 23:48:57 GMT
I thought maybe my issue was retained topics in mosquitto. Figured out how to clear them all out but still getting a blank payload. Tried publishing from MQTT.fx on a PC just in case mosquitto_pub wasn't forming the message properly and I have the exact same issue.
|
|
|
Post by selcouth on Mar 31, 2015 0:07:48 GMT
Figured it out. I had Visual Micro set to debug. I changed it to release and reuploaded the gateway code. Payload is received as expected.
Thanks again for help looking into this.
|
|