mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 09:17:48 +01:00
35 lines
756 B
Python
35 lines
756 B
Python
import asyncio
|
|
|
|
from core.api import Property, action
|
|
from core.api.step import CBPiSimpleStep
|
|
|
|
|
|
class CustomStepCBPi(CBPiSimpleStep):
|
|
|
|
name = Property.Number(label="Test")
|
|
|
|
i = 0
|
|
|
|
@action(key="name", parameters=None)
|
|
def test(self, **kwargs):
|
|
self.name="WOOHOO"
|
|
|
|
async def run_cycle(self):
|
|
|
|
|
|
#await asyncio.sleep(1)
|
|
self.i = self.i + 1
|
|
self.cbpi.notify(key="step", message="OH YES")
|
|
print("RUN STEP", self.id, self.name, self.__dict__)
|
|
|
|
|
|
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("CustomStepCBPi", CustomStepCBPi)
|