Fix typeerror hon#77
This commit is contained in:
parent
310d1bafd7
commit
55966dd52f
5 changed files with 5 additions and 5 deletions
|
@ -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