From 55db17e4fe415453896525a2713ec403264f6b94 Mon Sep 17 00:00:00 2001 From: chappo Date: Tue, 7 Jun 2022 13:35:06 +0800 Subject: [PATCH 1/2] Set Power to Zero if Switched Off Set power to Zero if the actor is switched off. --- cbpi/extension/mqtt_actor/generic_mqtt_actor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cbpi/extension/mqtt_actor/generic_mqtt_actor.py b/cbpi/extension/mqtt_actor/generic_mqtt_actor.py index c1a5b17..0d2681e 100644 --- a/cbpi/extension/mqtt_actor/generic_mqtt_actor.py +++ b/cbpi/extension/mqtt_actor/generic_mqtt_actor.py @@ -32,6 +32,6 @@ class GenericMqttActor(MQTTActor): self.state = True async def off(self): - formatted_payload = self.payload.format(switch_onoff = "off", switch_10 = 0, power = self.power) + formatted_payload = self.payload.format(switch_onoff = "off", switch_10 = 0, power = 0) await self.publish_mqtt_message(self.topic, formatted_payload) - self.state = False \ No newline at end of file + self.state = False From a4f1de3953fdb5af7ffade0b7915a18e7b4e0630 Mon Sep 17 00:00:00 2001 From: chappo Date: Tue, 7 Jun 2022 13:35:32 +0800 Subject: [PATCH 2/2] Set power to Zero if the actor is switched off. Set power to Zero if the actor is switched off. --- cbpi/extension/mqtt_actor/mqtt_actor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cbpi/extension/mqtt_actor/mqtt_actor.py b/cbpi/extension/mqtt_actor/mqtt_actor.py index 28dd198..5c651e2 100644 --- a/cbpi/extension/mqtt_actor/mqtt_actor.py +++ b/cbpi/extension/mqtt_actor/mqtt_actor.py @@ -39,7 +39,7 @@ class MQTTActor(CBPiActor): async def off(self): self.state = False await self.cbpi.satellite.publish(self.topic, json.dumps( - {"state": "off", "power": self.power}), True) + {"state": "off", "power": 0}), True) pass async def run(self): @@ -56,4 +56,4 @@ class MQTTActor(CBPiActor): else: await self.off() await self.cbpi.actor.actor_update(self.id,power) - pass \ No newline at end of file + pass