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
|
2018-12-06 23:46:06 +01:00
|
|
|
|
|
|
|
@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):
|
2019-01-04 09:29:09 +01:00
|
|
|
print("RUN", self.name)
|
2018-12-07 23:57:32 +01:00
|
|
|
self.i = self.i + 1
|
2019-01-04 09:29:09 +01:00
|
|
|
if self.i == 5:
|
|
|
|
# print("NEXT")
|
2018-12-16 21:42:47 +01:00
|
|
|
self.next()
|
2019-01-04 09:29:09 +01:00
|
|
|
#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)
|