lerner
Posts: 528
Joined: Sun Mar 29, 2015 12:12 am

MQTT - stuck.

Fri Jul 14, 2017 3:27 am

Hi folks,

"I'm ba-ack!"....

My MQTT interest has again been spiked and I am doing some reading on getting it working,

Alas, not all good news.

I can get it to talk "locally" but it falls over when I wan to talk machine to machine.
I also shall say that I may have had an "older" version of MQTT but after reading I found a link to the CORRECT version - or so I believe.

As the thread is OLD, I am asking anew.
But this is the cux of it:
(No offence Dougie)
viewtopic.php?p=1072534#p1072534
by DougieLawson » Mon Nov 09, 2015 11:33 pm
Nope. It's because you mosquitto server is not listening on the inaddr-any address.

Take a look at your mosquitto.conf, is there a "listener" line in there? Change

Code: Select all
listener 1883 127.0.0.1

to

Code: Select all
listener 1883

Um......... There is no line in /etc/mosquitto/mosquitto.conf that says that.



I used the walk through from:
http://mosquitto.org/2013/01/mosquitto- ... epository/
which was referenced in the above thread.

But all the "examples" given /that I find are for LOCAL stuff.
They don't go into the "between two separate machines" scenario.

On the one machine I get the messages sent through, but if I try from Machine 1 to Machine 2, it says

Code: Select all

mosquitto_pub -d -t test -m "Test"
Error: Connection refused

Yeah, right..... And I can't see how to get around that.


Thanks in advance.

pieuser
Posts: 38
Joined: Sat Jun 03, 2017 7:56 am

Re: MQTT - stuck.

Fri Jul 14, 2017 6:35 am

i have installed geany in raspbian and its working fine. but when i try to install mqtt mosquito its successfully installed but its not connecting in server to client and vice versa. is raspbian is not sufficient for mqtt and iot.

User avatar
rpdom
Posts: 17275
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: MQTT - stuck.

Fri Jul 14, 2017 6:41 am

pieuser wrote:i have installed geany in raspbian and its working fine. but when i try to install mqtt mosquito its successfully installed but its not connecting in server to client and vice versa. is raspbian is not sufficient for mqtt and iot.
Please don't hijack unrelated posts.

pieuser
Posts: 38
Joined: Sat Jun 03, 2017 7:56 am

Re: MQTT - stuck.

Fri Jul 14, 2017 6:46 am

is there any solution for this problem or no solution for this.

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: MQTT - stuck.

Fri Jul 14, 2017 6:50 am

lerner wrote:On the one machine I get the messages sent through, but if I try from Machine 1 to Machine 2, it says

Code: Select all

mosquitto_pub -d -t test -m "Test"
Error: Connection refused
.
The program has to know where your mosquitto server is.
It assumes 'localhost' when none is given.

Code: Select all

mosquitto_pub -h yourmosquittoserver -d -t test -m "Test"

lerner
Posts: 528
Joined: Sun Mar 29, 2015 12:12 am

Re: MQTT - stuck.

Fri Jul 14, 2017 7:42 am

From what I can see about "Geany", that is a text editor type program.

What does that have to do with MQTT?

lerner
Posts: 528
Joined: Sun Mar 29, 2015 12:12 am

Re: MQTT - stuck.

Fri Jul 14, 2017 8:02 am

DirkS wrote:
lerner wrote:On the one machine I get the messages sent through, but if I try from Machine 1 to Machine 2, it says

Code: Select all

mosquitto_pub -d -t test -m "Test"
Error: Connection refused
.
The program has to know where your mosquitto server is.
It assumes 'localhost' when none is given.

Code: Select all

mosquitto_pub -h yourmosquittoserver -d -t test -m "Test"
Can you please indulge me how to then tell it where to send it then?

As I explained: Following what I read on the posts referenced in the first post, it doesn't explain how to do that.

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: MQTT - stuck.

Fri Jul 14, 2017 8:06 am

lerner wrote:
DirkS wrote:
lerner wrote:On the one machine I get the messages sent through, but if I try from Machine 1 to Machine 2, it says

Code: Select all

mosquitto_pub -d -t test -m "Test"
Error: Connection refused
.
The program has to know where your mosquitto server is.
It assumes 'localhost' when none is given.

Code: Select all

mosquitto_pub -h yourmosquittoserver -d -t test -m "Test"
Can you please indulge me how to then tell it where to send it then?

As I explained: Following what I read on the posts referenced in the first post, it doesn't explain how to do that.
Euh... as I showed: use the -h parameter. Use name (e.g. rasperrypi.local) or IP address as the parameter
See https://mosquitto.org/man/mosquitto_pub-1.html

User avatar
bensimmo
Posts: 4654
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: MQTT - stuck.

Fri Jul 14, 2017 8:36 am

If it's not twigged.

-h yourmosquittoserver

Is the bit you are sending to as an IP 198.1.1.34 or its network name.
-h 198.1.1.34
-h PiAtHome.local
-h lerner.dyndys.org


(I've never used it, but reading so I can at some point).
Either way the first one need the IP to be reserved in the router for the Pi otherwise it might change. The second needs it to actually work on the network like that, the third is if you are trying from outside your network etc)
Last edited by bensimmo on Fri Jul 14, 2017 8:44 am, edited 1 time in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26716
Joined: Sat Jul 30, 2011 7:41 pm

Re: MQTT - stuck.

Fri Jul 14, 2017 8:42 am

pieuser wrote:i have installed geany in raspbian and its working fine. but when i try to install mqtt mosquito its successfully installed but its not connecting in server to client and vice versa. is raspbian is not sufficient for mqtt and iot.
Please start a new topic for this.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

lerner
Posts: 528
Joined: Sun Mar 29, 2015 12:12 am

Re: MQTT - stuck.

Fri Jul 14, 2017 9:58 pm

DirkS wrote:
As I explained: Following what I read on the posts referenced in the first post, it doesn't explain how to do that.
Euh... as I showed: use the -h parameter. Use name (e.g. rasperrypi.local) or IP address as the parameter
See https://mosquitto.org/man/mosquitto_pub-1.html
Thanks. Somehow I missed that.

Return to “Beginners”