What's new

MQTT : Mosquitto on a router

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Aa26

New Around Here
Hello,
I would like to know if we can install mosquitto on a router.
I have the rt-ac86u under asuswrt-merlin

Thank you
 
I have a RT-N66U and got the Mosquitto MQTT Broker (from Entware repo) working perfectly with my SONOFFs.
 
Hello,
This is probably a very basic question but I am a newbie at all this.. I have the mosquitto broker up and running on my RT-N66U with merlin, and all is working well. However, I cannot figure out how to have the mosquitto service auto-run after reboot, without me having to ssh in and start the service manually.
Would someone be kind enough to guide me through this?
Thanks and Happy New Year!
 
I have a RT-N66U and got the Mosquitto MQTT Broker (from Entware repo) working perfectly with my SONOFFs.
do you have a guide? i installed mosquitto, but now what? does it run automatically? how do i interact with it? i see instructions for a webgui running it on a pi, but i cant find much info.
 
Check to see if a startup script was installed in /opt/etc/init.d directory when mosquito was installed. If so, that script may need tweaking for your environment (usually the paths need to be adjusted to your environment).

Another option is to start your software from the /jffs/scripts/services-start script.
 
erg... i guess i just dont know what im doing...
:/tmp/home/root# /opt/etc/init.d
-sh: /opt/etc/init.d: Permission denied

and i also think i installed the client instead of the broker.
 
init.d is a directory. You will have to change directory to /opt/etc/init.d and see if a file exists there. It will be named S80 or S40 something. It will likely have the mosquito in the name.

Once you find the file, if there is one, you will need to edit it and see if the file path names in the file are correct. If there is no such file, you can to add or change the file /jffs/scripts/services-start and add a command line there to start your software.
 
ok so i added the mosquitto-ssl. figured out how to move around with cd /, and looked up ls to list files in current directory...
/entware/etc/init.d# ls
S80pixelserv-tls rc.func rc.func.div rc.unslung

so looks like its not there...

find /opt/etc/ -iname mosquitto
/opt/etc/mosquitto

entware/etc/mosquitto# ls
mosquitto.conf

that's not it...

find /opt/ -iname *mosquitto*
/opt/etc/mosquitto
/opt/etc/mosquitto/mosquitto.conf
/opt/lib/libmosquitto.so.1
/opt/lib/libmosquitto.so
/opt/lib/opkg/info/libmosquitto-ssl.list
/opt/lib/opkg/info/libmosquitto-nossl.list
/opt/lib/opkg/info/libmosquitto-ssl.control
/opt/lib/opkg/info/libmosquitto-nossl.control
/opt/lib/opkg/info/mosquitto-ssl.list
/opt/lib/opkg/info/mosquitto-ssl.control
/opt/lib/opkg/info/mosquitto-ssl.conffiles
/opt/lib/opkg/info/mosquitto-client-ssl.list
/opt/lib/opkg/info/mosquitto-client-ssl.control
/opt/include/mosquitto.h
/opt/include/mosquittopp.h
/opt/bin/mosquitto_passwd
/opt/bin/mosquitto_pub
/opt/bin/mosquitto_sub
/opt/sbin/mosquitto

nope!

find /opt/ -iname *S80*
/opt/etc/init.d/S80pixelserv-tls
/opt/share/diversion/file/S80pixelserv-tls

Strike three!

/jffs/scripts# ls
dnsmasq.postconf pre-mount unmount
post-mount services-stop

waduheck?

do you know what happens when you pour cornstarch on a fresh grave?
the plot thickens...

i used amtm to install diversion and entware, is something fundamental wrong here or it it me. if i can avoid it i would rather not factory wipe my router again. i am using an ac68r but i have a old n56u laying around. i was going to try it on that one first but Merlin doesn't support it. i guess i could look up how to get entware on it and try to go that rout so i can get a better idea...
 
Unfortunately, I can't help you in using Mosquito. I have never used the platform, although it sounds interesting and certainly worth learning. Winter time project for me.

What I can tell you is that the *.conf file will be the configuration file. You will need to edit this file to set up mosquito. The files ins /opt/bin and /opt/sbin will likely be the execuatuables. What each one does, I don't know. Some reading on Mosquito's website is in order to learn how to use Mosquito from the command line (https://mosquitto.org/). From the files listed above, I would say you have the client installed as opposed to the broker.

For the service-start script, there is not one yet. You will have to create it once you know which one of the execacutables to use and how to set up the .conf files for your needs.

For help on the Merlin start up scripts, you can read here;

https://github.com/RMerl/asuswrt-merlin.ng/wiki/User-scripts

Instead of vi and nano to edit the scripts/.conf file, I usually use WinSCP to access my router and use Notepad++ to edit scripts and other files (like the .conf file). lines in linux text files are not terminated the same as in Windows and DOS, so you can't use Notepad or the like. Notepad++ can save Unix style text files.

Don't get frustrated though. We all started out learning this stuff from scratch, although some forget that when it comes to giving help. For me, I have pretty much come to the end of what I can help you with as I have never used Mosquito.

Love the grave yard pun though... I will have to remember that one.

Cheers
 
so i managed to get it running. used nano to edit .conf... wow there is a ton of description for every setting... got mosquito broker running with a lot of trial and error. biggest issue was getting it running with the proper conf file as apparently it does not do this by default... meanwhile repeatedly trying to set the password file and making sure i was using absolute directory for password file. a true pain. got my tazmotad esp01 set to publish to it and sub'd in another putty instance. i could see updates but no sensor data that i could make out. shelved it for a few...

installed winSCP today, brings back memories of norton commander. this will be so much easier. i think i figured out making the service-start script. just subed using mqtt explorer on my computer and i can see SENSOR = {"Time":"2020-08-31T00:50:03","SR04":{"Distance":22.649}} eureka! sensor reading are finicky, i think that will clear up once its in a pipe. next is to figure out how to turn that distance into something more easily readable to determine water level... can a esp01 be hooked to a screen? a simple gauge would make life easier.

a guy walked up to my counter today and asked for a money order for twenty dollars ans twenty cents. i said oh no, you must be forking out money for hindsight. he chuckled a little and said no, why? i said because hindsight is 2020... he just about fell over.
 
HI Solraven,

Do you have MQTT working from the router now? if so, may I get instruction on how to make it work? (I have Asus 68 router)

thanks a lot!
 
It would be helpfull to see the configuration and a how-to run the mosquitto broker in detailed instruction.... but Solraven has disappeared...
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top