Skip to content

Commit

Permalink
Lights to percentage (#7)
Browse files Browse the repository at this point in the history
* Upddate README.md

* Change the light values to percentage and switches/occupancy to bool (1 or 0)
  • Loading branch information
GavinLucas authored Nov 12, 2024
1 parent 9d15518 commit f8b0e60
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 f8b0e60

Please sign in to comment.