Skip to content

A climate sensor logger client for a Mqtt or direct storage InfluxDB backend written in Python.

License

Notifications You must be signed in to change notification settings

wuan/klimalogger

Repository files navigation

PyPi-Package Lines of code Coverage Duplicated lines

Simple python client for logging measured climate data to InfluxDb.

Additional dependencies

Dependencies
Sensor Type Command
BME680 pip3 install adafruit-circuitpython-bme680
BMP085 pip3 install Adafruit_BMP
BMP3xx pip3 install adafruit-circuitpython-bmp3xx
SGP30 pip3 install adafruit-circuitpython-sgp30
SGP40 pip3 install adafruit-circuitpython-sgp40
SHT1x (no I2C) download and install https://bitbucket.org/lunobili/rpisht1x.git
SHT4x pip3 install adafruit-circuitpython-sht4x

Build and upload

python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/klimalogger-0.6.8.tar.gz

Install on server

Software

It is recommended to use a virtual environment.

virtualenv /usr/local/share/klimalogger
. /usr/local/share/klimalogger/bin/activate
pip install klimalogger

Then install hardware specific drivers e. g.

pip3 install adafruit-circuitpython-sht4x

Then setup the configuration file /etc/klimalogger.conf.

The sensor readout can be validated through

/usr/local/share/klimalogger/bin/klimalogger --check

The result should be JSON formatted measurement data.

In order to run the service for debugging use the following command line

/usr/local/share/klimalogger/bin/klimalogger --service --debug

Setup Service

Create a service configuration, for example /etc/systemd/system/klimalogger.service with the following content:

[Unit]
Description=Klimalogger Service
After=multi-user.target

[Service]
Type=simple
Restart=always
ExecStart=/usr/local/share/klimalogger/bin/klimalogger --service

[Install]
WantedBy=multi-user.target

and run

systemctl daemon-reload
systemctl enable klimalogger
service klimalogger start

to run the service.

About

A climate sensor logger client for a Mqtt or direct storage InfluxDB backend written in Python.

Resources

License

Stars

Watchers

Forks

Languages