install instructions

This commit is contained in:
2026-09-06 15:57:14 +02:00
parent 1e18920ec6
commit 57b5e2f2f5
4 changed files with 22 additions and 16 deletions
+1
View File
@@ -1,4 +1,5 @@
.env .env
.venv/
__pycache__/ __pycache__/
.pytest_cache/ .pytest_cache/
*.py[cod] *.py[cod]
+18 -13
View File
@@ -15,11 +15,16 @@ approximately five-minute averages for 90 days, and hourly averages for two year
## Install on Raspberry Pi OS or Debian ## Install on Raspberry Pi OS or Debian
Install the native RRDtool binding and Python dependencies: Install Python's virtual-environment support and the native headers needed to build
the RRDtool package, then install every Python dependency into `.venv`:
```bash ```bash
sudo apt update sudo apt update
sudo apt install python3 python3-flask python3-requests python3-rrdtool fonts-dejavu-core sudo apt install python3 python3-venv python3-dev build-essential librrd-dev fonts-dejavu-core
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
``` ```
Create the Hue application key if you do not have one yet. Press the bridge link Create the Hue application key if you do not have one yet. Press the bridge link
@@ -41,7 +46,7 @@ cp .env.example .env
set -a set -a
. ./.env . ./.env
set +a set +a
python3 -m hue_collector python -m hue_collector
``` ```
Open `http://PI_ADDRESS:8000`. The RRD files are written to `DATA_DIR`, which defaults Open `http://PI_ADDRESS:8000`. The RRD files are written to `DATA_DIR`, which defaults
@@ -49,13 +54,11 @@ to the project's `data/` directory.
## Run continuously with systemd ## Run continuously with systemd
Install the project and environment file: The included unit expects this repository at `/srv/service_hue_collector`, including
its `.venv` and `.env` files:
```bash ```bash
sudo install -d /opt/hue-collector sudo chmod 600 /srv/service_hue_collector/.env
sudo cp -r hue_collector /opt/hue-collector/
sudo cp .env /etc/hue-collector
sudo chmod 600 /etc/hue-collector
sudo cp hue-collector.service /etc/systemd/system/ sudo cp hue-collector.service /etc/systemd/system/
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable --now hue-collector sudo systemctl enable --now hue-collector
@@ -93,11 +96,13 @@ trusted.
## Development ## Development
On a Debian-based machine, install `python3-rrdtool` through apt. Flask and Requests Create the virtual environment and install all application dependencies from the
can alternatively be installed from `requirements.txt`. When using a virtual requirements file:
environment, create it with `--system-site-packages` so it can see the apt-installed
RRDtool module.
```bash ```bash
python3 -m unittest discover -s tests sudo apt install python3-venv python3-dev build-essential librrd-dev fonts-dejavu-core
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python -m unittest discover -s tests
``` ```
+2 -2
View File
@@ -8,9 +8,9 @@ Type=simple
DynamicUser=yes DynamicUser=yes
StateDirectory=hue-collector StateDirectory=hue-collector
WorkingDirectory=/srv/service_hue_collector WorkingDirectory=/srv/service_hue_collector
EnvironmentFile=/srv/service_hue_collector EnvironmentFile=/srv/service_hue_collector/.env
Environment=DATA_DIR=/var/lib/hue-collector Environment=DATA_DIR=/var/lib/hue-collector
ExecStart=/var/lib/hue-collector/.venv/bin/python3 -m hue_collector ExecStart=/srv/service_hue_collector/.venv/bin/python -m hue_collector
Restart=on-failure Restart=on-failure
RestartSec=5 RestartSec=5
PrivateTmp=yes PrivateTmp=yes
+1 -1
View File
@@ -1,3 +1,3 @@
# Install the native RRDtool binding with: apt install python3-rrdtool
Flask>=2.2,<4 Flask>=2.2,<4
requests>=2,<3 requests>=2,<3
rrdtool>=0.1,<1