nicer graphs i hope

This commit is contained in:
2026-08-30 15:04:40 +02:00
parent 21cf23088c
commit a5ac054f57
4 changed files with 59 additions and 19 deletions
+6
View File
@@ -92,6 +92,10 @@ class Collector:
"# TYPE hue_group_lights_available gauge",
"# HELP hue_group_lights_shining Number of connected lights that are on.",
"# TYPE hue_group_lights_shining gauge",
"# HELP hue_group_lights_off Number of connected lights that are off.",
"# TYPE hue_group_lights_off gauge",
"# HELP hue_group_lights_unavailable Number of configured lights that are disconnected.",
"# TYPE hue_group_lights_unavailable gauge",
"# HELP hue_group_lights_shining_percent Percentage of connected lights that are on.",
"# TYPE hue_group_lights_shining_percent gauge",
"# HELP hue_group_lights_off_percent Percentage of connected lights that are off.",
@@ -120,6 +124,8 @@ class Collector:
labels = {"group_type": kind, "group": group.get("metadata", {}).get("name", group["id"]), "group_id": group["id"]}
lines.append(_sample("hue_group_lights_available", len(lights), **labels))
lines.append(_sample("hue_group_lights_shining", len(shining), **labels))
lines.append(_sample("hue_group_lights_off", off, **labels))
lines.append(_sample("hue_group_lights_unavailable", unavailable, **labels))
lines.append(_sample("hue_group_lights_shining_percent", 100 * len(shining) / len(lights) if lights else 0, **labels))
lines.append(_sample("hue_group_lights_off_percent", 100 * off / len(lights) if lights else 0, **labels))
lines.append(_sample("hue_group_lights_unavailable_percent", 100 * unavailable / len(all_lights) if all_lights else 0, **labels))