Skip to content

Commit

Permalink
Change the light values to percentage and switches/occupancy to bool …
Browse files Browse the repository at this point in the history
…(1 or 0)
  • Loading branch information
GavinLucas committed Nov 12, 2024
1 parent 13a3ef8 commit c84b8fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions huetoinflux.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c84b8fd

Please sign in to comment.