Example #1
0
    async def on_stop(self):
        await self.timer.stop()
        self.summary = ""
        await self.push_update()

    async def reset(self):
        self.timer = Timer(int(self.props.Timer) * 60, on_update=self.on_timer_update, on_done=self.on_timer_done)

    async def run(self):
        while self.running == True:
            await asyncio.sleep(1)
        return StepResult.DONE


@parameters([Property.Select(label="toggle_type", options=["On", "Off"],description="Choose if Actor should be switched on or off in this step"),
             Property.Actor(label="Actor",description="Actor that should be toggled during this step")])
class ToggleStep(CBPiStep):
    async def on_timer_done(self, timer):
        self.summary = ""
        await self.next()

    async def on_timer_update(self, timer, seconds):
        self.summary = Timer.format_time(seconds)
        await self.push_update()

    async def on_start(self):
        if self.timer is None:
            self.timer = Timer(1, on_update=self.on_timer_update, on_done=self.on_timer_done)
        self.timer.start()
        self.type=self.props.get("toggle_type","Off")
        self.Actor=self.props.get("Actor", None)
Example #2
0
    async def reset(self):
        self.timer = Timer(int(self.props.Timer) * 60,
                           on_update=self.on_timer_update,
                           on_done=self.on_timer_done)

    async def run(self):
        while self.running == True:
            await asyncio.sleep(1)
        return StepResult.DONE


@parameters([
    Property.Number(label="Timer",
                    description="Time in Minutes",
                    configurable=True),
    Property.Actor(label="Actor")
])
class ActorStep(CBPiStep):
    async def on_timer_done(self, timer):
        self.summary = ""
        await self.next()

    async def on_timer_update(self, timer, seconds):
        self.summary = Timer.format_time(seconds)
        await self.push_update()

    async def on_start(self):
        if self.timer is None:
            self.timer = Timer(int(self.props.Timer) * 60,
                               on_update=self.on_timer_update,
                               on_done=self.on_timer_done)
Example #3
0
    async def reset(self):
        self.timer = Timer(int(self.props.Timer) * 60,
                           on_update=self.on_timer_update,
                           on_done=self.on_timer_done)

    async def run(self):
        while self.running == True:
            await asyncio.sleep(1)
        return StepResult.DONE


@parameters([
    Property.Number(label="Timer",
                    description="Time in Minutes",
                    configurable=True),
    Property.Actor(label="Actor")
])
class ActorStep(CBPiStep):
    async def on_timer_done(self, timer):
        self.summary = ""
        await self.next()

    async def on_timer_update(self, timer, seconds):
        self.summary = Timer.format_time(seconds)
        await self.push_update()

    async def on_start(self):
        if self.timer is None:
            self.timer = Timer(int(self.props.Timer) * 60,
                               on_update=self.on_timer_update,
                               on_done=self.on_timer_done)