in winter and cold condition the spike might be triggered through the shower -> false positive spike |
||
|---|---|---|
| lib | ||
| .gitignore | ||
| config.ini.example | ||
| dht22sensor.py | ||
| DHT22Sensor.service | ||
| README.md | ||
| requirements.txt | ||
DHT22, raspberry to InfluxDB system
This script reads a DHT22 temperature and humidity sensor on a raspberry pi (>=3) and sends it to a InfluxDB server.
Aditionally the dewpoint will be calculated (only accurate between -45°C <= Temperature <= 60°C).
The local weather can be gathered via openweathermap
If you include the WiFi Sensor, your current WiFi readings (SSID, RSSI etc.) will also be transmitted. To log all available wifis run the script as root.
Requirements
The pi should run a raspbian distribution and needs
- enabled
SPIwithsudo sudo raspi-configand enable SPI
- enabled
I2Cwithsudo apt-get install -y python-smbus i2c-toolssudo raspi-configand enable I2Csudo reboot
- python3 with pip and virtualenv
sudo apt-get install python3 python3-pip virtualenv- create virtual environment with
virtualenv -p python3 venvsource venv/bin/activatepip install -r requirements.txtsudo apt-get install libgpiod2
- copy config file
cp config.ini.example config.iniand edit appropriately
Wifi reports only the local connected WiFi for a standard user. For all visible wifis use it as root.
Setup
Connect the Sensor with +3,3V, and GND to your pi, and add a dataline from the sensor to GPIO 4.
To change the GPIO change the line:
self.sensor = adafruit_dht.DHT22(board.D4) in ./lib/dht22_sensor.py
to your desired GPIO.
Make sure to edit ./config.ini appropriately. Start the script with:
python3 ./dht22sensor.py.
systemd service
Copy ./DHT22Sensor.service to your systemd unitfile path and start/enable it. Presumably you might want to change
the line
ExecStart=/opt/DHT22/venv/bin/python3 /opt/DHT22/dht22sensor.py
to the correct path.
Docs
License
Author Stefan Maier Licence GNU GPLv3
Contributing
Bug reports and pull requests are welcome on my website or mail to git@univ-exp.com