MQTT

From NURDspace

What

MQTT is pronounced 'mosquito' , ISO20922 describes it.

It's a simple messaging protocol with a publish/subscribe based model.

Where

It seems to run at 10.208.1.49(you shouldnt connect by IP) aka mqtt.vm.nurd.space on the default port of 1883. This is actually running on Jarvis. We kept the ip and name when we moved the services from Arbiter. But stopped doing so now.

EMQX will allow unauthenticated subscriptions on port 1883 from the internet networks. External networks must use TLS + Auth and have a specific ACL created to allow only access to the needed topics.

EMQX gui can be found on jarvis in the menu.

Public MQTT

http://10.208.1.54:18083/ http://publicmqtt.vm.nurd.space:18083/

Currently only bridges the msh topic for the meshtastic

The broker is reachable on space.nurdspace.nl port 8883 with tls

Using Auth / TLS

for the username and password to access the EMQX gui ask around

  • MQTT port: 8883
  • WSS port: 8084

Updating the ACL

There are already ACLs in place to allow everything from inside the space specific user ACL's would only be needed if its external.

Emqx-edit-acl-step1.png https://www.emqx.io/docs/en/v5/access-control/authz/file.html#acl-file-format

  • Allowing a user to subscribe to a specific topic
{allow, {user, "meshuser"}, subscribe, ["msh/#"]}.

Whats it used for

Power Meter

The Power_Meter project publishes it's readings to the following topics;

#define MQTT_TOPIC_WATT "powermeter/watt"
#define MQTT_TOPIC_KWH "powermeter/kwh"
#define MQTT_TOPIC_PULSE "powermeter/pulsecount"

(from; https://github.com/NURDspace/kwhMeter/blob/master/src/config.h_sample)

temperature/humidity

  • DASTEMPERATUR: zaal 1
  • DASTEMPERATUR2: gamers room
  • DASTEMPERATURbar: bar
  • DASTEMPERATURplee: women's toilet

Used topics

this/list/is/very outdated

power/main/pulsecount 1441113
power/main/kwh 3842.968
power/main/watt 235
space/state 0
space/grotezaal/rechts/1 off
space/grotezaal/rechts/1/stat off
space/hal/rechts/1 off
space/hal/rechts/1/stat off
space/bar/1 off
space/bar/1/stat off
space/makerhoek/1 off
space/makerhoek/1/stat off
stat/sonoff/POWER ON
stat/audioamp/POWER OFF
sonoff/POWER ON
sonoff/audioamp/POWER ON
tele/audioamp/LWT Online
cmnd/audioamp/POWER OFF DASTEMPERATUR2 { "epoch":1533487686, "temperature":  28.0, "humidity":  18.4 }
DASTEMPERATURbar { "epoch":1533487706, "temperature":  29.0, "humidity":  34.0 }
DASTEMPERATUR { "epoch":1533487707, "temperature":  32.6, "humidity":  29.0 }
DASTEMPERATURplee { "epoch":1533487710, "temperature":  30.0, "humidity":  27.0 }


Bridge Internal/External

Config

The config is more or less the same. Both sides are configured the same way as seen in the screenshots below. Both have a user call bridge which is used for this and rules to filter away the msgs coming from the bridge else loops will occur!!!!

Public-mqtt-egressrule.png

Public-mqtt-egress-bridge-1.png

Public-mqtt-egress-bridge-2.png