This project provides a framework to easily connect IoT devices (sensors and switches) with different backends. It allows to include more backends and devices.
- BME280 sensor: humidity, air pressure, temperature
- ADS1115 sensor: analog digital converter
- BH1750: illuminance
- Raspberry PI GPIO switches: drive GPIO pins on the raspberry pi. To actually drive the pins you need to use the mqtt-hass backend.
- Shell command switches: run shell commands when a switch is clicked in Home Assistant. Has an 'on' and an 'off' command.
- Raspberry PI cover for garage doors or covers as defined by Home Assistant. It uses two input pins to detect the closed or opened state of the cover and one output pin which triggers a pulse so that the garage door motor is put into action.
Backends can set and read states if the functionality of the software used provides this. Pure database backends like influx will only store the values from the sensors.
- Home Assistant with MQTT discovery: works for sensors and switches
- InfluxDB: works for sensors only, will ignore switches
- Install .deb packages: 'sudo apt install python3-yaml'
- Install PIP packages: 'pip3 install smbus2 RPi.GPIO rpi.bme280 paho-mqtt influxdb'
Hint: On Raspbian GNU/Linux 9.13 (stretch) don't use the .deb package 'python3-influxdb' but the much newer pip3 package 'influxdb'
- Get some sensors and a small device to run the sensors on. The device should be able to run python.
- Make sure you habe a suitable backend that will store the data or interact with the sensors. That's why you are here, right? So maybe you have an Home Assistant installation already. Then please check that mqtt is enabled. Otherwise: get one or get an InfluxDB instance.
- Clone this project at the device and copy the example setup to a setup.yaml and edit the content of the setup file according to your needs.
- Run rooftop.py. Maybe with a screen session, but much better as a service (via systemd).
Send me a message, I'll write this when its needed. It should be easy to add more of both kinds.