mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-05-20 09:55:09 -04:00
Improve update performance
This commit is contained in:
parent
38d09e2ef5
commit
7b51caecca
10 changed files with 63 additions and 49 deletions
|
@ -2,9 +2,9 @@ from pyhon.appliances.base import ApplianceBase
|
|||
|
||||
|
||||
class Appliance(ApplianceBase):
|
||||
def data(self, data):
|
||||
super().data(data)
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("attributes", {}).get("activity"))
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue