mirror of
https://github.com/Andre0512/pyhOn.git
synced 2026-06-19 19:56:57 +02:00
Handle mqtt connection events
This commit is contained in:
@@ -7,7 +7,7 @@ from pyhon.appliances.base import ApplianceBase
|
||||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
if not self.parent.connection:
|
||||
data["parameters"]["machMode"].value = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
return data
|
||||
|
||||
@@ -6,7 +6,7 @@ from pyhon.appliances.base import ApplianceBase
|
||||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
if not self.parent.connection:
|
||||
data["parameters"]["temp"].value = 0
|
||||
data["parameters"]["onOffStatus"].value = 0
|
||||
data["parameters"]["remoteCtrValid"].value = 0
|
||||
|
||||
@@ -8,7 +8,7 @@ from pyhon.parameter.fixed import HonParameterFixed
|
||||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
if not self.parent.connection:
|
||||
data["parameters"]["machMode"].value = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
data["pause"] = data["parameters"]["machMode"] == "3"
|
||||
|
||||
@@ -7,7 +7,7 @@ from pyhon.appliances.base import ApplianceBase
|
||||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
if not self.parent.connection:
|
||||
data["parameters"]["machMode"].value = "0"
|
||||
data["active"] = bool(data.get("activity"))
|
||||
data["pause"] = data["parameters"]["machMode"] == "3"
|
||||
|
||||
Reference in New Issue
Block a user