Skip to content

Commit

Permalink
change presence (diyhue#911)
Browse files Browse the repository at this point in the history
* Update espDevices.py

extend error msg

* Update espDevices.py

extend return msg

* Update espDevices.py

Add args lightlevel, daylight, temperature

* Update espDevices.py

change presence
  • Loading branch information
hendriksen-mark authored May 13, 2023
1 parent 52dc324 commit 08ff4e3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions BridgeEmulator/flaskUI/espDevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ def get(self):
obj.dxState["daylight"] = current_time
obj.state["daylight"] = daylight
elif obj.type == "ZLLPresence":
obj.state["presence"] = True
obj.dxState["presence"] = current_time
if obj.protocol_cfg["threaded"] == False:
Thread(target=noMotion, args=[device]).start()
presence = True if args["presence"] == "true" else False
if obj.state["presence"] != presence:
obj.state["presence"] = presence
obj.dxState["presence"] = current_time
if obj.protocol_cfg["threaded"] == False:
Thread(target=noMotion, args=[device]).start()
elif obj.type == "ZLLTemperature":
obj.state["temperature"] = int(args["temperature"])
obj.dxState["temperature"] = current_time
Expand All @@ -85,7 +87,7 @@ def get(self):
obj.state["lastupdated"] = datetime.utcnow().strftime(
"%Y-%m-%dT%H:%M:%S")
rulesProcessor(obj, current_time)
logging.debug("obj.type:" + obj.type + "command applied")
logging.debug("obj.type: " + obj.type + " command applied")
result = {"success": "command applied"}
else:
result = {"fail": "device not found"}
Expand Down

0 comments on commit 08ff4e3

Please sign in to comment.