Page 4 of 17

Re: MQTT Client

Posted: Sat Oct 03, 2015 12:56 pm
by wawa79
Thanx a lot :D

Re: MQTT Client

Posted: Sun Nov 15, 2015 3:22 pm
by RiseUp
mlava wrote:Scratch all that...
I now have it working, it was more about the format of the topic definitions on my side, not a problem with the plugin.
Sorry to have wasted your time! Silly me... :roll:
Can you share what you did to fix it? I am experiencing the same issue that you had (i.e. no MQTT messages being seen by EG's MQTT client, with or without the leading "/").

Re: MQTT Client

Posted: Mon Nov 16, 2015 6:15 am
by krambriw
How does your topic definition in EG MQTT Client look like?

How does the mqtt event look like that you are publishing?

Are you able to see any mqtt message with another mqtt client? Like the MQTT.fx client?

Re: MQTT Client

Posted: Tue Nov 17, 2015 3:27 am
by RiseUp
krambriw wrote:How does your topic definition in EG MQTT Client look like?
I am testing with the topic as:

Code: Select all

eventghost/#
krambriw wrote:How does the mqtt event look like that you are publishing?
I am using Node-RED (from a Raspberry Pi on my LAN) to test the MQTT on Eventghost. Currently, I am just sending a timestamp as the payload.
krambriw wrote:Are you able to see any mqtt message with another mqtt client? Like the MQTT.fx client?
Yes, with the MQTT.fx client, I am receiving the messages. And my mosquitto broker's log says that it is sending the messages to my Eventghost (best that I can tell, at least). However, even with EG's log set to show unassigned events, I see nothing that shows it's receiving the MQTT messages. Any idea what's going on?

Re: MQTT Client

Posted: Tue Nov 17, 2015 5:12 am
by krambriw
Yes, with the MQTT.fx client, I am receiving the messages
Copy & paste some messages here so I can see the structure of them

Re: MQTT Client

Posted: Tue Nov 17, 2015 11:49 pm
by RiseUp
krambriw wrote:Copy & paste some messages here so I can see the structure of them
I'm not sure if I'm misunderstanding you, or if I've confused you. I am sending MQTT messages from Node-RED on my R-Pi to Eventghost on my PC. For testing purposes, I am simply sending a timestamp. If the copy/paste of the message helps, here is one:

Code: Select all

1447804039460
If in fact I am misunderstanding what you're asking for, I apologize. :oops:

Re: MQTT Client

Posted: Wed Nov 18, 2015 5:41 am
by krambriw
OK, fine, I see

The thing is that in general topics need to be with a leading slash (/)

So in your case, you have to set the topic to /eventghost/#

When you publish the timestamp in the RPi, you have to publish it to the topic /eventghost

If this still does not work, we could start debugging. Open the __init__.py file for the MQTT Client plugin with a text editor, insert the following code at line 173, save and restart EG

Code: Select all

            print msg.topic
            print msg.payload

PS another possible solution could eventually work if you use the topic NRED (without leading slash) on both sides. In EG, configure the topic as NRED/# and in RPi, publish to topic NRED

Re: MQTT Client

Posted: Thu Nov 19, 2015 1:23 am
by RiseUp
krambriw wrote:OK, fine, I see

The thing is that in general topics need to be with a leading slash (/)

So in your case, you have to set the topic to /eventghost/#

When you publish the timestamp in the RPi, you have to publish it to the topic /eventghost
On mosquitto's man page, all their examples have no leading slash, so I was doing the same. If you mean that your plugin is expecting that leading slash, then so be it. :D
krambriw wrote:If this still does not work, we could start debugging. Open the __init__.py file for the MQTT Client plugin with a text editor, insert the following code at line 173, save and restart EG

Code: Select all

            print msg.topic
            print msg.payload

PS another possible solution could eventually work if you use the topic NRED (without leading slash) on both sides. In EG, configure the topic as NRED/# and in RPi, publish to topic NRED
After adding those lines to the code, I can see the printouts in EG's log! Yay!

And...it works both with and without the leading slash!

So where do we go from here?

Re: MQTT Client

Posted: Thu Nov 19, 2015 4:45 am
by krambriw
If you mean that your plugin is expecting that leading slash
Yeah, that is needed in the normal case (with some special exceptions for the topics NRED, switchking, nethomeserver, zwave and rfxtrx, then it is not needed. You see them if you scroll down the code )
So where do we go from here?
OK, so the correct time stamp is now printed. Do you also see it as event in the EG log on the left side? If so, you can comment out or delete those lines we just added. Next is to start using the event to trigger macros...or just...I don't know what you wanna do. I guess the time stamp was just a test signal. If you have other information to transfer from the RPi, the principal is the same.

(If uncertain, always make a partial screen shot or copy & paste partly from your log, makes it easier to capture what you have working...and what is not)

Re: MQTT Client

Posted: Fri Nov 20, 2015 12:52 am
by RiseUp
Good idea on the screenshot. This is EG's log of me testing it with the debugging print statements you asked me to insert into the code. Also, I have included the plugin settings window to see how I have it configured.

It appears I am not getting an event in EG. Does everything look okay so far?

Re: MQTT Client

Posted: Fri Nov 20, 2015 7:30 am
by krambriw
It looks ok I think, you should receive events.

I have configured it similar and here it works when I publish a timestamp like that to a broker
Skärmklipp.JPG

PS just an idea! If you could change your setting to publish on the same broker & topic, I would expect that I would receive your time stamps and then I could see further what kind of problem there could be!

Re: MQTT Client

Posted: Sat Nov 21, 2015 1:46 am
by RiseUp
OK, so I really have no idea what the heck changed, but somehow...it's now working. :shock:

According to my best recollection, the only thing I changed was that I deleted the disabled "Keyboard" plugin from my EG configuration. I can't imagine that that would have anything to do with the MQTT plugin. In fact, I even re-added the keyboard plugin, re-disabled it, and re-tested MQTT, and it still worked. So, I cannot recreate the non-working situation.

Thank you so much, krambriw, for sticking with me to help me get your plugin working, even when it seems like it was some kind of issue on my side. :oops:

Re: MQTT Client

Posted: Sat Nov 21, 2015 6:53 am
by krambriw
Well, good to hear, finally a happy end

Best regards, Walter

Re: MQTT Client

Posted: Thu Dec 10, 2015 4:40 pm
by MikeD82
Your website seems to be down. Is you plugin available via github?

Re: MQTT Client

Posted: Thu Dec 10, 2015 9:34 pm
by krambriw
Sorry for that, my apache server stops sharing from time to time ... unknown reason, trying to fix it now...

Should be accessible now again