This wiki has been archived and made read-only.
For up-to-date information about TkkrLab and it's projects please visit our main website at tkkrlab.nl.

MQTT

From

Revision as of 22:18, 21 May 2017 by Renze (Talk | contribs) (Indeling tkkrlab/sonoff topic)

Jump to: navigation, search

Server

mrmeeseeks (10.42.1.2)

Topic opbouw

tkkrlab/# -> Voor Tkkrlab / Space berichten <nickname>/# -> Voor je eigen creaties

Gebruik alleen je eigen nickname als begin van je topics!

Luisteren naar pakketjes:

 mosquitto_sub -h mrmeeseeks -t "tkkrlab/#" -v

Topics

  • tkkrlab/powermanagement/# -> Wake-on-lan verzoeken
  • tkkrlab/statusduino/spaceknop (retained) -> Space status schakelaar: values: 1 (aan) of 0 (uit)
  • tkkrlab/spacestate (retained) -> Space status: geeft aan of de space open of dicht is. Values: 1 (open) of 0 (dicht)
  • tkkrlab/sonoff/# -> Sonoff relay modules

Indeling tkkrlab/powermanagement topic

Het publiceren van een bericht naar tkkrlab/powermanagement/<hostname> schakelt een computer in de space in of uit.

Toegestane values: 1 (on) en 0 (off). Als de staat van de machine niet overeen komt met het laatst ontvangen bericht dan reageert het systeem door de computer te starten met wake-on-lan of af te sluiten via een systeemservice op de machine zelf.

-> Let op: maak berichten in dit topic nooit persistent!

Indeling tkkrlab/sonoff topic

  • tkkrlab/sonoff/<device>/cmd/POWER -> Lezen en schrijven van status: values: 1 (aan) of 0 (uit)
  • tkkrlab/sonoff/<device>/telemetry/LWT -> Status / watchdog
  • tkkrlab/sonoff/<device>/telemetry/STATE -> JSON met systeeminfo over node.
{"Time":"2017-05-21T21:13:57", "Uptime":1, "Vcc":3.237, "POWER":"1", "Wifi":{"AP":1, "SSID":"www.tkkrlab.nl", "RSSI":78, "APMac":"D8:C7:C8:A7:A8:31"}}

IRC bot

The IRC bot watches the MQTT server at the tkkrlab/spacestate topic to get space status. It is also possible for ops to use !force_status 0 / !force_status 1 to update the status manually, this will publish a retained message to tkkrlab/spacestate.