Merge pull request #52 from chappo/master

Set MQTT Actor Power Level to Zero if Switched Off
This commit is contained in:
Alexander Vollkopf 2022-07-10 18:17:29 +02:00 committed by GitHub
commit 459c4207fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -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
self.state = False

View file

@ -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
pass