From 0fa77c72d67acadb0da15779acb259bc4cc38147 Mon Sep 17 00:00:00 2001 From: Ignace Date: Sat, 22 Aug 2026 11:58:48 +0200 Subject: [PATCH] added marker lines --- HOWTO.md | 10 ++++++---- config.yaml | 7 +++++++ read_temperature.py | 5 +++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/HOWTO.md b/HOWTO.md index 7ce3fee..e2649d7 100644 --- a/HOWTO.md +++ b/HOWTO.md @@ -404,7 +404,9 @@ samples existed before the RRD was created. Temperature uses the left axis with a default range of 0–30°C. Humidity and battery use the right axis with a default range of 0–100%. These ranges and -labels can be changed in `config.yaml` under `graph.axes`. +labels can be changed in `config.yaml` under `graph.axes`. Light-grey reference +lines are drawn at 15, 20, and 25°C by default and can be changed under +`graph.axes.temperature.reference_lines`. The collector also generates `/var/www/html/sensors/index.html`. It displays six graphs at a time and has controls for switching between the daily, monthly, @@ -442,9 +444,9 @@ To run it automatically as a user service, copy the supplied service file. It assumes this repository is located at `$HOME/service_zigbee`: ```bash -cp zigbee-sensor.service.example /etc/systemd/system -systemctl --user daemon-reload -systemctl --user enable --now zigbee-sensor.service +cp zigbee-sensors.service.example /etc/systemd/system +systemctl daemon-reload +systemctl enable --now zigbee-sensors.service ``` Inspect its status and live logs with: diff --git a/config.yaml b/config.yaml index c6b895e..643317d 100644 --- a/config.yaml +++ b/config.yaml @@ -78,6 +78,13 @@ graph: minimum: 0 maximum: 30 label: degrees C + reference_lines: + - value: 15 + color: D3D3D3 + - value: 20 + color: D3D3D3 + - value: 25 + color: D3D3D3 percentage: minimum: 0 maximum: 100 diff --git a/read_temperature.py b/read_temperature.py index 609f1b0..3de1517 100644 --- a/read_temperature.py +++ b/read_temperature.py @@ -211,6 +211,10 @@ def render_graphs(sensor: Sensor, rrd_path: Path, config: Config) -> None: percentage_transform = ( f"{percentage_minimum},-,{percentage_to_temperature},*,{temperature_minimum},+" ) + reference_lines = [ + f"HRULE:{float(line['value'])}#{line['color']}" + for line in temperature_axis.get("reference_lines", []) + ] optional_flags = [] if graph.get("slope_mode", False): optional_flags.append("--slope-mode") @@ -235,6 +239,7 @@ def render_graphs(sensor: Sensor, rrd_path: Path, config: Config) -> None: f"CDEF:humidity_scaled=humidity,{percentage_transform}", f"CDEF:battery_scaled=battery,{percentage_transform}", f"AREA:temp#{temperature['color']}:{temperature['legend']}", + *reference_lines, f"LINE{humidity['line_width']}:humidity_scaled#{humidity['color']}:{humidity['legend']}", f"LINE{battery['line_width']}:battery_scaled#{battery['color']}:{battery['legend']}:dashes={battery['dashes']}", f"GPRINT:temp:LAST:{temperature['last_value_format']}",