mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-12-22 10:45:31 +00:00
Fix typeerror hon#77
This commit is contained in:
parent
310d1bafd7
commit
55966dd52f
|
@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
return data
|
||||
|
|
|
@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["temp"] = "0"
|
||||
data["parameters"]["onOffStatus"] = "0"
|
||||
data["parameters"]["remoteCtrValid"] = "0"
|
||||
|
|
|
@ -5,7 +5,7 @@ from pyhon.parameter.fixed import HonParameterFixed
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
data["pause"] = data["parameters"]["machMode"] == "3"
|
||||
|
|
|
@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
data["pause"] = data["parameters"]["machMode"] == "3"
|
||||
|
|
|
@ -4,7 +4,7 @@ from pyhon.appliances.base import ApplianceBase
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data):
|
||||
data = super().attributes(data)
|
||||
if data["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
data["pause"] = data["parameters"]["machMode"] == "3"
|
||||
|
|
Loading…
Reference in a new issue