mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +01:00
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:
parent
b2e61bee8e
commit
db39d82432
3 changed files with 13 additions and 9 deletions
|
@ -1 +1 @@
|
|||
__version__ = "4.0.0.52"
|
||||
__version__ = "4.0.0.54"
|
||||
|
|
14
cbpi/cli.py
14
cbpi/cli.py
|
@ -255,11 +255,15 @@ def plugins_list():
|
|||
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||
|
||||
for p in data["plugins"]:
|
||||
p_metadata= metadata(p)
|
||||
p_Homepage= p_metadata['Home-page']
|
||||
p_version = p_metadata['Version']
|
||||
p_Author = p_metadata['Author']
|
||||
print("- ({})\t{}".format(p_version,p))
|
||||
try:
|
||||
p_metadata= metadata(p)
|
||||
p_Homepage= p_metadata['Home-page']
|
||||
p_version = p_metadata['Version']
|
||||
p_Author = p_metadata['Author']
|
||||
print("- ({})\t{}".format(p_version,p))
|
||||
except Exception as e:
|
||||
print (e)
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue