aboutsummaryrefslogtreecommitdiffstats

Energyscripts

This is a small collection of scripts I use to collect information about my energyconsumption.

Set up venv

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install .

If running scripts/neihub.py or scripts/esphomeapi.py, also run pip install ".[esphome]" and pip install ".[neohub]".

If you want dev-stuff, run pip install ".[dev]".

Upgrading venv after upgrading python

Same as above, only throw in --upgrade between venv and venv.

Schema

Install schema psql el < schema.sql

schema.sql created with: pg_dump --schema-only --no-owner --no-privileges el

Systemd

Example:

ln -s /opt/energyscripts/energyscripts-SCRIPT@ADDRESS.service /etc/systemd/system/energyscripts-mqtt_listener.service
ln -s /opt/energyscripts/energyscripts-SCRIPT@ADDRESS.service /etc/systemd/system/energyscripts-esphomeapi@airgradient.local.net.service

systemctl enable energyscripts-mqtt_listener.service energyscripts-esphomeapi@airgradient.local.net.service
systemctl start energyscripts-mqtt_listener.service energyscripts-esphomeapi@airgradient.local.net.service
journalctl -fu "energyscripts-*"

TODO:

Put every state in states-table. Entities in an entity-table, and devices in a device-table.