Onion Omega "Single Command" with Losant refused

Hello,
My Onion Omega2+ threw an error when trying to connect to Losant using the Single Command connection. I’m using this tutorial from Onion’s 2-Bullet Tuesday newsletter which explains how to setup Losant and Omega to connect.

In the middle of the tutorial, there is a one-line script that will complete the setup and connect the Omega to the Losant application that was previously set up. When i entered the script into my Omega: mosquitto_sub -t losant/[YOUR-DEVICE-ID]/command, it threw an error: Error: Connection refused.

In a different thread, I was told that I needed to enter my Device ID, Access Key, and Access Secret, which I did do as instructed by the tutorial:

.

How do I fix this error?
Thank You!

Hi @Microbob,

The screenshot you have doesn’t seem to have the error you mentioned. Could you post a shot with the error message?

When you try to connect, have your Communication Log open. Do you see any errors come up in there?

Hello,
Sorry for not clarifying that the screenshot I provided was what the tutorial said should happen, and it didn’t for me. Here’s a screenshot of what happens when I do it:

.

Hope this helps!

Thanks for the screenshot!

So, have you looked at the communication log? Do you see anything in there?

I’m actually not 100% sure where the communication log is, but the device, debug, and data tabs all look the same before and after running mosquitto_sub

If you go to the main application page, the communication log will be here:

Also, here is the documentation: Communication Log

Hey I am also following the same tutorial from Onion Omega.

I have entered the device id, access id and access key.

However after entering the subscribe to command. Losant is still saying

Awaiting first connection to Losant ...

@anaptfox

One thing to note.

mosquitto_pub takes a host argument, and if it’s missing then it uses localhost. You examples do not include -h which implies you would be talking to a local broker (possibly setup as a bridge to losant).

If that is the case, is the mosquitto local broker running.

If not then the connection refused will be the result.

If you are not running a local broker then you need to supply a host.
T

mosquitto_sub -t losant/[YOUR-DEVICE-ID]/command

This is what the tutorial FROM omega guide side
https://onion.io/2bt-single-command-losantomega/

@Tim_Hoffman @anaptfox Does Losant have a public host for demoing purpose? If you can provide a solution that would be fantastic. Thanks for the helpm

Yep

If you look at the shell script from in the guide https://raw.githubusercontent.com/OnionIoT/Losant-Setup-Script/master/losant_setup.sh you will see it does in fact setup a local broker.
And the command you are issuing connects to localhost.

In your case I suggest the local broker isn’t starting.

Check that this command succeeded

/etc/init.d/mosquitto restart

a quick
ps auxw | grep mosquitto

will tell you if the local mosquitto broker is running.

T