G+_Jason Perry Posted December 11, 2016 Share Posted December 11, 2016 I have a mosquitto MQTT broker up and running, now I have a few questions. Are there any good tutorials on how it works? Not how to use it but something that will help me understand its quirks. The previous question kinda leads into this next one. Is there a way to see a list of topics? Is there a setting to keep a log of the topics? Link to comment Share on other sites More sharing options...
G+_David Wiggins Posted December 11, 2016 Share Posted December 11, 2016 mosquitto.org - mqtt And http://mqtt.org/wiki May have some of the raw information you need. From looking at it, I think I need to learn more about it, it seems quite nifty. I hope the documentation is well populated and maintained and proves useful to you. Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 11, 2016 Author Share Posted December 11, 2016 David Wiggins?, I have been looking at it for a long time now. Kinda excited to start playing. Originally I was hoping to dive into the directories and learn from there but I think it is going to have to be from published documentation. Link to comment Share on other sites More sharing options...
G+_David Wiggins Posted December 11, 2016 Share Posted December 11, 2016 I can't wait to hear back what you learn. It really does look fun. I can see how useful it would be on my bedroom lights project ( once I even get it working), to remotely monitor and trigger an input. Oddly enough, it could make one part much simpler (setting the timer). Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 11, 2016 Author Share Posted December 11, 2016 David Wiggins, I used the first half of this video to set up my MQTT Server. really it is just a few commands sudo apt-get install mosquitto sudo apt-get install mosquitto-clients sudo nano /etc/mosquitto/mosquitto.conf delete include_dir /etc/mosquitto/conf.d add allow_anonymous false password_file /etc/mosquitto/pwfile (pwfile or whatever name you prefer) listener 1883 sudo mosquitto_passwd -c /etc/mosquitto/pwfile username (this will prompt you to make a password) sudo reboot Link to comment Share on other sites More sharing options...
G+_Steven Traversino Posted December 11, 2016 Share Posted December 11, 2016 David Wiggins oddly enough that lights project is the exact reason I use mqtt. I have a few raspberry pis setup that control ws2812 light strips. I wanted them to work independently, but at the same time automate some actions with my phone. Example is at night I plug my phone in, it sends a message true to the bedtime topic, each pi has a Python script setup to read the topic and preform an action if it's true. In that case it turns off my house lights and sets a 90 second timer on my bedroom lights. I've been working on replacing them with arduino with esp8266, have the code working but got too busy to finish up the whole project. As to the question asked. The command line mosquito_sub tool should allow you to see all topics and messages coming through. But if you haven't set anything up to send a message it probably won't display anything. For me I learned by trial and error, and work experience in SQL using service broker accounts which work somewhat similar. Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 11, 2016 Author Share Posted December 11, 2016 Steven Traversino?, where did you find your resources for using python? That's how I want to build in the logic to my system. Link to comment Share on other sites More sharing options...
G+_Steven Traversino Posted December 11, 2016 Share Posted December 11, 2016 Jason Perry I set it up a long time ago so I'm not sure of the exact site I used. It's called paho.mqtt.client. For mine I defined a list of topics for it to listen to in an array. Then have a folder on each pi that are named the same as the topics with True or False (or whatever message is sent) and then some Python logic to call each script upon the message in the queue. Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 12, 2016 Author Share Posted December 12, 2016 Steven Traversino?, thanks that sounds like what I am reading right now. Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 12, 2016 Author Share Posted December 12, 2016 For everyone who is following here is a link to a python wiki going over how to use a MQTT broker in your code pypi.python.org - paho-mqtt 1.1 : Python Package Index Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 13, 2016 Author Share Posted December 13, 2016 Another fun tool I found nodered.org - Node-RED Link to comment Share on other sites More sharing options...
G+_David Wiggins Posted December 13, 2016 Share Posted December 13, 2016 Steven Traversino? , Jason Perry?, I am thrilled by what has been posted here. This cold go a long way in solving some problems for me, too. Very cool. Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 13, 2016 Author Share Posted December 13, 2016 I realized this was a huge topic but the more I look it's even larger than I realized. I could post links all day long. openhab.org - openHAB Link to comment Share on other sites More sharing options...
G+_Jason Perry Posted December 13, 2016 Author Share Posted December 13, 2016 Link to comment Share on other sites More sharing options...
Recommended Posts