MQTT: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
Line 4: Line 4:


My MQTT Server is in a docker container on [[Bellman]].
My MQTT Server is in a docker container on [[Bellman]].
I set up a Docker image of eclipse-mosquitto on [[Bellman]].
I can log into it and run commands to learn more.
sensors/thermostat/start
sensors/thermostat/stop
sensors/thermostat/temperature
sensors/thermostat/setpoint
# julie arrived
# julie left
Listen for presence messages from anyone. QOS is set to 'at least once'. -d is for debug
docker exec -it mosquitto mosquitto_sub -t 'sensors/+/presence' -q 1 -d
Send a message.
docker exec -it mosquitto mosquitto_pub -t 'sensors/unifi/presence' -q 1 -d -m 'Julie arrived'
How should my messages look?
presence/SENSOR/NEWSTATE
where SENSOR = {unifi|dnsmasq} and NEWSTATE = {arrived|departed}
and the payload is one of ACTOR = {Julie|Brian|Unknown}
The publisher will translate input from the sensor (Unifi in this case) to the actor value (Julie or Brian).
The subscribers don't usually need to know if the sensor was a phone or a facial recognition camera or RFID or...
Some subscribers (the thermostat) don't care who the actor is, just whether or not anyone is home.


[[Category: IoT]]
[[Category: IoT]]

Revision as of 02:42, 4 January 2020

I'm looking at MQTT right now in the context of Presence Detection.

There are some good books in Safari including "Hands-on MQTT Programming With Python".

My MQTT Server is in a docker container on Bellman.

I set up a Docker image of eclipse-mosquitto on Bellman. I can log into it and run commands to learn more.

sensors/thermostat/start sensors/thermostat/stop sensors/thermostat/temperature sensors/thermostat/setpoint

  1. julie arrived
  2. julie left

Listen for presence messages from anyone. QOS is set to 'at least once'. -d is for debug

docker exec -it mosquitto mosquitto_sub -t 'sensors/+/presence' -q 1 -d

Send a message.

docker exec -it mosquitto mosquitto_pub -t 'sensors/unifi/presence' -q 1 -d -m 'Julie arrived'

How should my messages look?

presence/SENSOR/NEWSTATE
where SENSOR = {unifi|dnsmasq} and NEWSTATE = {arrived|departed}
and the payload is one of ACTOR = {Julie|Brian|Unknown}

The publisher will translate input from the sensor (Unifi in this case) to the actor value (Julie or Brian). The subscribers don't usually need to know if the sensor was a phone or a facial recognition camera or RFID or... Some subscribers (the thermostat) don't care who the actor is, just whether or not anyone is home.