added marker lines

This commit is contained in:
2026-08-22 11:58:48 +02:00
parent 8a44eb8dc8
commit 0fa77c72d6
3 changed files with 18 additions and 4 deletions
+6 -4
View File
@@ -404,7 +404,9 @@ samples existed before the RRD was created.
Temperature uses the left axis with a default range of 030°C. Humidity and Temperature uses the left axis with a default range of 030°C. Humidity and
battery use the right axis with a default range of 0100%. These ranges and battery use the right axis with a default range of 0100%. 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 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, 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`: assumes this repository is located at `$HOME/service_zigbee`:
```bash ```bash
cp zigbee-sensor.service.example /etc/systemd/system cp zigbee-sensors.service.example /etc/systemd/system
systemctl --user daemon-reload systemctl daemon-reload
systemctl --user enable --now zigbee-sensor.service systemctl enable --now zigbee-sensors.service
``` ```
Inspect its status and live logs with: Inspect its status and live logs with:
+7
View File
@@ -78,6 +78,13 @@ graph:
minimum: 0 minimum: 0
maximum: 30 maximum: 30
label: degrees C label: degrees C
reference_lines:
- value: 15
color: D3D3D3
- value: 20
color: D3D3D3
- value: 25
color: D3D3D3
percentage: percentage:
minimum: 0 minimum: 0
maximum: 100 maximum: 100
+5
View File
@@ -211,6 +211,10 @@ def render_graphs(sensor: Sensor, rrd_path: Path, config: Config) -> None:
percentage_transform = ( percentage_transform = (
f"{percentage_minimum},-,{percentage_to_temperature},*,{temperature_minimum},+" 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 = [] optional_flags = []
if graph.get("slope_mode", False): if graph.get("slope_mode", False):
optional_flags.append("--slope-mode") 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:humidity_scaled=humidity,{percentage_transform}",
f"CDEF:battery_scaled=battery,{percentage_transform}", f"CDEF:battery_scaled=battery,{percentage_transform}",
f"AREA:temp#{temperature['color']}:{temperature['legend']}", f"AREA:temp#{temperature['color']}:{temperature['legend']}",
*reference_lines,
f"LINE{humidity['line_width']}:humidity_scaled#{humidity['color']}:{humidity['legend']}", 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"LINE{battery['line_width']}:battery_scaled#{battery['color']}:{battery['legend']}:dashes={battery['dashes']}",
f"GPRINT:temp:LAST:{temperature['last_value_format']}", f"GPRINT:temp:LAST:{temperature['last_value_format']}",