circuits.core.timers module

Timer component to facilitate timed events.

class circuits.core.timers.Timer(interval, event, *channels, **kwargs)

Bases: circuits.core.components.BaseComponent

Timer Component

A timer is a component that fires an event once after a certain delay or periodically at a regular interval.

Parameters:
  • interval (datetime or number of seconds as a float) – the delay or interval to wait for until the event is fired. If interval is specified as datetime, the interval is recalculated as the time span from now to the given datetime.
  • event (Event) – the event to fire.
  • persist (bool) – An optional keyword argument which if True will cause the event to be fired repeatedly once per configured interval until the timer is unregistered. If False, the event fires exactly once after the specified interval, and the timer is unregistered. Default: False
expiry
reset(interval=None)

Reset the timer, i.e. clear the amount of time already waited for.