Set power to Zero if the actor is switched off.

Set power to Zero if the actor is switched off.
This commit is contained in:
chappo 2022-06-07 13:35:32 +08:00 committed by GitHub
parent 55db17e4fe
commit a4f1de3953
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,7 +39,7 @@ class MQTTActor(CBPiActor):
async def off(self): async def off(self):
self.state = False self.state = False
await self.cbpi.satellite.publish(self.topic, json.dumps( await self.cbpi.satellite.publish(self.topic, json.dumps(
{"state": "off", "power": self.power}), True) {"state": "off", "power": 0}), True)
pass pass
async def run(self): async def run(self):
@ -56,4 +56,4 @@ class MQTTActor(CBPiActor):
else: else:
await self.off() await self.off()
await self.cbpi.actor.actor_update(self.id,power) await self.cbpi.actor.actor_update(self.id,power)
pass pass