MQTT testing

Hi, not sure what I’m doing wrong here.

I’ve setup the emonpi to log data locally and remotely, all ok.

Got to the MQTT user guide, used SSH to test publish and subscribe in two windows. One window open for publish, one for subscribe. In don’t know why this test isn’t working

tried entering the exact text:

mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/#’

Result= -bash: mosquitto_sub: command not found

then tried:

mosquitto_sub -v -u emonpi -P emonpimqtt2016 -t emon/#

result= -bash: mosquitto_sub: command not found

then tried:

mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘test’

result:

-bash: mosquitto_sub: command not found

tried

mosquitto_sub -v -u emonpi -P emonpimqtt2016 -t test

result:

-bash: mosquitto_sub: command not found

Looked at the admin and the emoncms and the service is active. All logs in the emonhub seem to be ok. I’m just not able to work out why mosquitto isn’t working.

any ideas?

@Phase

When I copy and paste yr line above into an SSH terminal …

mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘test’

… I get Connection refused - not authorised

When I copy and paste the apparently same line from the OEM Resources …

mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t 'test'

… it works fine and sits there waiting for a message to be published.

The single quote marks are different - ASCI codes 8216 and 39

I too on occassions have had the message …

-bash: mosquitto_sub: command not found

In my case due to carelessly copying & pasting a leading blank in front of the mosquitto ~~~~~

bash does seem to be very unforgiving :frowning_face:

1 Like

Hi,
thanks for getting back to me.
I’ve tried cutting and pasting the command:
mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/#’

right click to paste into shh terminal, result=
-bash: mosquitto_sub: command not found

tried the following:
mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/emonpi/#’
right click to paste into shh terminal, result=
-bash: mosquitto_sub: command not found

tried the following:
mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘test’
right click to paste into shh terminal, result=
-bash: mosquitto_sub: command not found

not really sure what’s going on.

here is the emonhub locally:

2020-11-28 15:48:28,799 DEBUG MQTT Publishing: emon/emonpi/power1 622
2020-11-28 15:48:28,801 DEBUG MQTT Publishing: emon/emonpi/power2 0

the above updated values are being received remotely at emoncms.org.

I just cant get the local broker to work for some reason

regards

@Phase

Try copying this line exactly and pasting with no leading blank …

mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t 'test'

I’m using Windows 10

1 Like

It is telling you the package is not installed.

sudo apt-get install mosquitto-clients

@Phase

This may/may not be informative …
http://www.mauvecloud.net/charsets/CharCodeFinder.html

You could try it with a …

Then with a …

'
1 Like

Great.

thank you, that was very helpful.

Thanks so much. That installed the packaged. Then reset again and can now see all the values using the wildcard command.

thanks again!