Difference between revisions of "MQTT"
m (added todo) |
(added proposed topics) |
||
Line 26: | Line 26: | ||
Read it's status by subscribing to the sensor topics: <code>mosquitto_sub -h 192.168.1.100 -t "tele/+/SENSOR"</code> | Read it's status by subscribing to the sensor topics: <code>mosquitto_sub -h 192.168.1.100 -t "tele/+/SENSOR"</code> | ||
+ | |||
+ | == topics == | ||
+ | The proposed topic hierarchy is as followed: | ||
+ | <code>[base]/[room]/[device]/[prefix]/[type]</code> | ||
+ | Where both [prefix] and [type] come from [https://tasmota.github.io/docs/MQTT/#mqtt-topic-definition Tasmota's topic definition] (<code>tele</code> <code>stat</code> <code>cmnd</code> and <code>SENSOR</code> <code>STAT</code> <code>RESULT</code> <code>POWER</code> respectively). | ||
+ | |||
+ | At least <code>ackspace</code>, <code>common</code>, <code>outside</code> and <code>services</code> are supported as base. In the future, we can extend this to support something like <code>offsite</code> and the names of participants. | ||
+ | |||
+ | Since ACKspace doesn't have rooms at different levels, the second hierarchy level consist of the room, like <code>slackspace</code>, <code>hackspace</code> and <code>stackspace</code>. <code>device</code> is the name of the device (similar as Tasmota's <code>%topic%</code>) like <code>spacestate</code>, <code>temperature</code>, <code>hackswitch</code> or <code>fluorescent1</code>. | ||
+ | |||
+ | At least the following topics will be implemented first: | ||
+ | * <code>ackspace/hackspace/spacestate/stat/RESULT</code> (json power state) | ||
+ | ** <code>ackspace/hackspace/spacestate/stat/POWER1</code> (string power state) | ||
+ | ** <code>ackspace/hackspace/spacestate/tele/STATE</code> (json state at interval) | ||
+ | * <code>ackspace/hackspace/temperature/tele/SENSOR</code> (json telemetry data) | ||
+ | * <code>outside/courtyard/barbecue/tele/SENSOR</code> (json telemetry data) | ||
== todo == | == todo == |
Revision as of 13:55, 7 November 2021
Project: MQTT | |
---|---|
Featured: | No |
State | Active |
Members | xopr |
GitHub | mqtt spaceAPI |
Description | Space empty? Power off! |
Picture | |
No project picture! Fill in form Picture or Upload a jpeg here |
Contents
synopsis
Read sensors and do some space automation using the Message Queuing Telemetry Transport protocol.
Currently, you can see the solder table powerstrip connected in the power graph.
current status
There is a sonoff Pow wifi switch in the space, connected to a powerstrip near the soldering table (in a brown plastic case with a toggle switch on top of it).
The idea is to gradually add them to every power strip so we can:
- measure (over)current
- switch them off centrally if the space is closed (or notify the user that they are still on).
It currently runs a modified version of the famous Tasmota firmware (the modification allows dangerous GPIO whist using the energy measurement).
NOTE: the switch is built in a box with an external toggle switch. This switch has potentially 240v on its contacts so don't open it and touch the contacts when it is plugged in! Also don't connect both serial and mains; things will break.
You can toggle it via wifi on h1r-2067.lan (subject to change), or by issuing a mosquitto_pub -h 192.168.1.100 -t "cmnd/h1r/POWER" -m "TOGGLE"
Read it's status by subscribing to the sensor topics: mosquitto_sub -h 192.168.1.100 -t "tele/+/SENSOR"
topics
The proposed topic hierarchy is as followed:
[base]/[room]/[device]/[prefix]/[type]
Where both [prefix] and [type] come from Tasmota's topic definition (tele
stat
cmnd
and SENSOR
STAT
RESULT
POWER
respectively).
At least ackspace
, common
, outside
and services
are supported as base. In the future, we can extend this to support something like offsite
and the names of participants.
Since ACKspace doesn't have rooms at different levels, the second hierarchy level consist of the room, like slackspace
, hackspace
and stackspace
. device
is the name of the device (similar as Tasmota's %topic%
) like spacestate
, temperature
, hackswitch
or fluorescent1
.
At least the following topics will be implemented first:
ackspace/hackspace/spacestate/stat/RESULT
(json power state)ackspace/hackspace/spacestate/stat/POWER1
(string power state)ackspace/hackspace/spacestate/tele/STATE
(json state at interval)
ackspace/hackspace/temperature/tele/SENSOR
(json telemetry data)outside/courtyard/barbecue/tele/SENSOR
(json telemetry data)
todo
- add MOAR sensors (upgrade the current temperature sensors)
- connect the space state to the MQTT server
- MOAR sonoffs
- define a better channel hierarchy