Some fixes

- command line cbpi plugins -> not interrupted if plugin has not been installed correctly
- round power value submitted by mqtt plugin
This commit is contained in:
avollkopf 2021-11-26 22:54:55 +01:00
parent b2e61bee8e
commit db39d82432
3 changed files with 13 additions and 9 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.52"
__version__ = "4.0.0.54"

View file

@ -255,6 +255,7 @@ def plugins_list():
data = yaml.load(f, Loader=yaml.FullLoader)
for p in data["plugins"]:
try:
p_metadata= metadata(p)
p_Homepage= p_metadata['Home-page']
p_version = p_metadata['Version']
@ -263,6 +264,9 @@ def plugins_list():
except Exception as e:
print (e)
pass
except Exception as e:
print(e)
pass
print("--------------------------------------")

View file

@ -10,7 +10,7 @@ class MQTTActor(CBPiActor):
# Custom property which can be configured by the user
@action("Set Power", parameters=[Property.Number(label="Power", configurable=True,description="Power Setting [0-100]")])
async def setpower(self,Power = 100 ,**kwargs):
self.power=int(Power)
self.power=round(Power)
if self.power < 0:
self.power = 0
if self.power > 100:
@ -29,7 +29,7 @@ class MQTTActor(CBPiActor):
if power != self.power:
power = min(100, power)
power = max(0, power)
self.power = int(power)
self.power = round(power)
await self.cbpi.satellite.publish(self.topic, json.dumps(
{"state": "on", "power": self.power}), True)
self.state = True
@ -49,7 +49,7 @@ class MQTTActor(CBPiActor):
return self.state
async def set_power(self, power):
self.power = power
self.power = round(power)
if self.state == True:
await self.on(power)
else: