craftbeerpi4-pione/core/extension/dummystep/__init__.py

38 lines
729 B
Python
Raw Normal View History

2018-12-03 22:16:03 +01:00
import asyncio
2018-12-29 00:27:19 +01:00
from cbpi_api import *
2018-12-03 22:16:03 +01:00
2018-12-10 22:13:28 +01:00
class CustomStepCBPi(CBPiSimpleStep):
2018-12-03 22:16:03 +01:00
2018-12-05 07:31:12 +01:00
name = Property.Number(label="Test")
2018-12-08 14:21:00 +01:00
2018-12-07 23:57:32 +01:00
i = 0
@action(key="name", parameters=None)
def test(self, **kwargs):
self.name="WOOHOO"
2018-12-05 07:31:12 +01:00
2018-12-07 23:57:32 +01:00
async def run_cycle(self):
2018-12-05 07:31:12 +01:00
#await asyncio.sleep(1)
2018-12-07 23:57:32 +01:00
self.i = self.i + 1
2018-12-16 21:42:47 +01:00
self.name="HALLO WELT"
if self.i == 20:
self.next()
self.cbpi.notify(key="step", message="HELLO FROM STEP")
2018-12-29 00:27:19 +01:00
2018-12-03 22:16:03 +01:00
def setup(cbpi):
'''
This method is called by the server during startup
Here you need to register your plugins at the server
:param cbpi: the cbpi core
:return:
'''
2018-12-10 22:13:28 +01:00
cbpi.plugin.register("CustomStepCBPi", CustomStepCBPi)