Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 1.02 KB

File metadata and controls

19 lines (15 loc) · 1.02 KB

RPI-MQTT-JSON-Multisensor

Raspberry Pi MQTT JSON Multisensor for Home Assistant. Supported sensors include the AM312 PIR, DHT11/22 temperature/humidity sensors.

Requirements

  • paho-mqtt (install using pip)
  • Adafruit_DHT (install via their git repo)
  • gpiozero (installed by default on Raspi - link to docs)

Configuring

Under the 'Configuration' section of the script replace the appropriate variables. If you don't use authentication with a private MQTT server just leave it with null information. Using a DHT11 instead of a DHT22? Just change line 43.

Running

You can simply run the file with ./multisensor.py (after configuring) in a terminal and go on your merry way or run it as a service.

Running as a service

Systemd

  • Copy rpi-sensor.service to /etc/systemd/system/
  • Run (as root) systemctl enable rpi-sensor.service
  • Run (as root) systemctl start rpi-sensor.service