2018-12-03 22:16:03 +01:00
|
|
|
import asyncio
|
|
|
|
|
2018-12-06 23:46:06 +01:00
|
|
|
from core.api import Property, action
|
2018-12-03 22:16:03 +01:00
|
|
|
from core.api.step import Step
|
|
|
|
|
|
|
|
|
|
|
|
class CustomStep(Step):
|
|
|
|
|
2018-12-05 07:31:12 +01:00
|
|
|
name = Property.Number(label="Test")
|
2018-12-06 23:46:06 +01:00
|
|
|
_interval = 1
|
|
|
|
|
|
|
|
@action(key="name", parameters=None)
|
|
|
|
def test(self, **kwargs):
|
|
|
|
self.name="WOOHOO"
|
2018-12-05 07:31:12 +01:00
|
|
|
|
2018-12-03 22:16:03 +01:00
|
|
|
async def run(self):
|
2018-12-06 23:46:06 +01:00
|
|
|
|
2018-12-05 07:31:12 +01:00
|
|
|
#await asyncio.sleep(1)
|
2018-12-06 23:46:06 +01:00
|
|
|
|
2018-12-05 07:31:12 +01:00
|
|
|
print("RUN STEP", self.id, self.name, self.__dict__)
|
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:
|
|
|
|
'''
|
|
|
|
|
|
|
|
cbpi.plugin.register("CustomStep", CustomStep)
|