-
1Get your Raspberry Pi ready
In my case, I lacked all the peripherals (mouse, keyboard, monitor), so I followed this tutorials to get the Pi to run without.
https://medium.com/@viveks3th/how-to-bootstrap-a-headless-raspberry-pi-with-a-mac-6eba3be20b26
-
2Download Mosquitto
Copy paste this into the terminal:
curl -O http:
<a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-repo.gpg.key">//repo.mosquitto.org/debian/mosquitto-repo.gpg.key</a>"">//repo.mosquitto.org/debian/mosquitto-repo.gpg.key">//repo.mosquitto.org/debian/mosquitto-repo.gpg.key</a>"</a>><a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-repo.gpg.key">//repo.mosquitto.org/debian/mosquitto-repo.gpg.key</a>"><a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-repo.gpg.key">//repo.mosquitto.org/debian/mosquitto-repo.gpg.key</a></a></a>
sudo apt-key add mosquitto-repo.gpg.key
rm mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo curl -O http:
<a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-jessie.list">//repo.mosquitto.org/debian/mosquitto-jessie.list</a>"">//repo.mosquitto.org/debian/mosquitto-jessie.list">//repo.mosquitto.org/debian/mosquitto-jessie.list</a>"</a>><a target="_blank" rel="noopener noreferrer" href="<a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-jessie.list">//repo.mosquitto.org/debian/mosquitto-jessie.list</a>"><a target="_blank" rel="noopener noreferrer" href="//repo.mosquitto.org/debian/mosquitto-jessie.list">//repo.mosquitto.org/debian/mosquitto-jessie.list</a></a></a>
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients
Credit goes to @Elliot Williams for putting this together/ writing this.
and then:
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
sudo rm mosquitto-jessie.list -
3MQTT Terms - broker (server), client, topic, publish, subscribe, unsubscribe
Thanks to @bald engineer https://www.baldengineer.com/mqtt-introduction.html
Message Broker Introduction
A messaging broker system is a publish/subscribe protocol based on a “hub and spoke” model. Great. What does that mean? First some terms and then an analogy.
Message Brokering Basic Terms
- Broker: The broker accepts messages from clients and then delivers them to any interested clients. Messages belong to a topic. (Sometimes brokers are called “servers.”)
- Client: A “device” that either publishes a message to a topic, subscribes to a topic, or both.
- Topic: A namespace (or place) for messages on the broker. Clients subscribe and publish to a topic.
- Publish: A client sending a message to the broker, using a topic name.
- Subscribe: A client tells the broker which topics interest it. Once subscribed, the broker sends messages published to that topic. (In some configurations the broker sends “missed” messages.) A client can subscribe to multiple topics.
- Unsubscribe: Tell the broker you are bored with this topic. In other words, the broker will stop sending messages on this topic.
-
4Set up the client
In @Elliot Williams article, he sets up a Wemo with NodeMCU.: https://hackaday.com/2016/05/17/minimal-mqtt-networked-nodes/
I have an Adafruit Feather (this board has an ESP8266 on it) and I'm going to set this up as an MQTT client using the Arduino IDE.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.