From c84b8fdc20b696dafc4e27db8dc4277755637c3f Mon Sep 17 00:00:00 2001 From: Gavin Lucas Date: Tue, 12 Nov 2024 20:46:39 +0000 Subject: [PATCH] Change the light values to percentage and switches/occupancy to bool (1 or 0) --- huetoinflux.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/huetoinflux.py b/huetoinflux.py index dacd79e..ca928ba 100644 --- a/huetoinflux.py +++ b/huetoinflux.py @@ -91,11 +91,11 @@ def parse_data(): elif device["type"] == "ZLLLightLevel": data[name] = round(float(10 ** ((device["state"]["lightlevel"] - 1) / 10000)), 2) elif device["type"] == "ZLLPresence": - data[name] = 254 if device["state"]["presence"] else 0 + data[name] = int(1 if device["state"]["presence"] else 0) for device in hue_data["lights"].values(): name = device_name_to_name(device["name"]) - data[name] = device["state"].get("bri", 254) if device["state"]["on"] else 0 + data[name] = int(device["state"].get("bri", 2.54) / 2.54) if device["state"]["on"] else 0 return data