Skip to content

MQTT services

Julian Todd edited this page Jun 24, 2019 · 17 revisions

MQTT is a lightweight publish/subscribe messaging protocol applicable to many scenarios such as controlling and monitoring all the equipment in the space.

  • See Sonoff switches for MQTT controlled mains power monitors and switches.
  • See ESP devices for accounts of the ESP8266 and ESP32s in operation

MQTT Broker

There is an MQTT broker running on the RaspberryPi wired into the network in the main room with the DNS name "mqtt.local" and set up from ballina.

It can also be accessed through its own hotspot "DoESLiverpool-MQTT" and stable ip-number "10.3.141.1". If you connect your wifi-enabled MQTT devices to this network then they can be taken elsewhere (with a copy of the MQTT-broker) for demonstration purposes. However, for local infrastructure, connections to the main "DoESLiverpool" wifi is preferred

Node-red

At present the node-red instance is also on the same Rpi with an official 7inch touchscreen capable of showing a small dashboard with multiple tabs that you can swipe between.

You can log on to the Node-red screen using http://mqtt.local:1880 or preview the dashboard at http://mqtt.local:1880/ui which shows on the touchscreen display.

We expect to move the node-red flow system to a different Rpi with its own databases and backups of flows, for the sake of reliability.

Doing MQTT from the command line

Install mosquitto and then try the following commands:

To see all messages, type: mosquitto_sub -v --host mqtt.local --topic '#' (sometimes you need mqtt.localdomain)

To publish a message, type: mosquitto_pub --host mqtt.local --topic this/that/777 -m "Hooray"

Mains controlled devices

See Sonoff switches.

Other MQTT devices

MQTT to voice device

like at: https://github.com/DoESLiverpool/somebody-should/issues/809

Galvo level

Also looks like a coffee level pointer. https://github.com/goatchurchprime/jupyter_micropython_developer_notebooks/blob/master/projects/mqtt2galvo.ipynb (Currently on loan.)

Doorbots

These don't yet have any MQTT responses, but should do, so we can plot them.
https://github.com/DoESLiverpool/somebody-should/issues/949

Video analysing devices

We have the tech to convert live stream to data (eg using a camera looking at the coffee pot). This needs to be rebuilt.

Old provisioning of the Rpi (before using ballina technology)

See also https://github.com/DoESLiverpool/somebody-should/issues/803

* Install raspbian and update, plugged into ethernet

* sudo raspi-config (to enable ssh and change hostname)

* ifconfig to get the ip number

* from: https://oneguyoneblog.com/2017/06/20/mosquitto-mqtt-node-red-raspberry-pi/

* sudo apt-get install mosquitto mosquitto-clients

* sudo apt-get install nodejs

* sudo apt-get install nodered

* sudo node-red  (makes it run prior to reboot)

* sudo systemctl enable nodered.service

* sudo npm i -g npm@2.x

* In localhost:1880 nodered menu manage pallette install, look for dashboard

* sudo apt-get install avahi-daemon

* sudo nano /etc/hosts; change 127.0.1.1 to host name "mqtt"

Install hotspot installer: https://github.com/billz/raspap-webgui
* wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap

* Connect to wifiname=raspi-webgui password=ChangeMe, then http://10.3.141.1/ Username: admin, password: secret

* Change so that wifiname=mqtt-wifi, password=bubblino; and Auth is admin, arduino

* node-red at http://10.3.141.1:1880/
Clone this wiki locally
You can’t perform that action at this time.