/mqttautomation

Real-world tools to build (home) automation around MQTT

Primary LanguageCGNU General Public License v3.0GPL-3.0

mqttautomation

This projects provides several tools built around MQTT. Combining some of these tools let you automate things, like your house, or whatever.

The configuration of the automation is stored in MQTT using retained messages. mqttimport may settle those initially.

example MQTT topic layout

  • home/doorbell 1 when the doorbell rings
  • home/doorbell/inputhw key:2 mybeaglebone, mybeaglebone will publish key numbered 2 to home/doorbell
  • home/doorbell/onchange ${1} if "The doorbell rings" >{home/alert} fi, publish home/alert='The doorbell rings" whenever ...
  • home/garage set to 1 to move the the garage port
  • home/garage/ledhw relay:p9.11 mybeaglebone, mybeaglebone will drive led named p9.11 from home/garage
  • state/time dow, HH:MM:SS, current system time
  • state/time/fmtnow %a, %H:%M:%S, current system time strftime format
  • state/lat Geo position's lattitude
  • state/lon Geo position's longitude
  • state/sun/elv Current's sun elevation
  • state/sun/azm Sun's azimuth
  • home/nightled State of the leds in hall
  • home/nightled/logic ${state/sun/elv} 0 <, turn on home/nightled when the sun sets, until sun rise.
  • home/hall State of the light in hall
  • home/hall/logic ${.} ${./timer} offtimer
  • home/hall/timer Timeout spec for hall light, like 3m

data normalization

Wherever possible, mqttautomation will use 0 and 1 for boolean variable, ranges go from 0 to 1 (floating point).

exceptions

  • sun position in expressed in degrees (DD:MM:SS format supported)
  • timeofday is expressed in hours (HH:MM:SS format supported)

tools

mqttnow

  • publishes/updates the current system time

mqttsun

  • publishes the sun's position, based on lattitude+longitude.
  • Multiple geo locations are supported.

mqttinputevent

  • publish input event to MQTT topics
  • different hosts supported in 1 single MQTT namespace

mqttled

  • drive linux LEDs from MQTT topics

mqttmaclight:

  • publish the macbook light sensor input to MQTT
  • range from 0 to 1

mqttimport

  • write retained messages from file to MQTT topics that have no retained messages set This can be used to initialize an MQTT namespace with proper defaults.

mqttlogic

  • Updates MQTT topics based on other topics (keep status up to date)
  • emit MQTT topics on change of other MQTT topics. (event-based).