Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.stream.core.IdleTimer Class Reference

Public Member Functions

None __init__ (self, HomeAssistant hass, int timeout, Callable[[], Coroutine[Any, Any, None]] idle_callback)
 
None awake (self)
 
None clear (self)
 
None fire (self, datetime.datetime _now)
 
None start (self)
 

Public Attributes

 idle
 

Private Attributes

 _callback
 
 _hass
 
 _timeout
 
 _unsub
 

Detailed Description

Invoke a callback after an inactivity timeout.

The IdleTimer invokes the callback after some timeout has passed. The awake() method
resets the internal alarm, extending the inactivity time.

Definition at line 225 of file core.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.stream.core.IdleTimer.__init__ (   self,
HomeAssistant  hass,
int  timeout,
Callable[[], Coroutine[Any, Any, None]]  idle_callback 
)
Initialize IdleTimer.

Definition at line 232 of file core.py.

Member Function Documentation

◆ awake()

None homeassistant.components.stream.core.IdleTimer.awake (   self)
Keep the idle time alive by resetting the timeout.

Definition at line 251 of file core.py.

◆ clear()

None homeassistant.components.stream.core.IdleTimer.clear (   self)
Clear and disable the timer if it has not already fired.

Definition at line 258 of file core.py.

◆ fire()

None homeassistant.components.stream.core.IdleTimer.fire (   self,
datetime.datetime  _now 
)
Invoke the idle timeout callback, called when the alarm fires.

Definition at line 264 of file core.py.

◆ start()

None homeassistant.components.stream.core.IdleTimer.start (   self)
Start the idle timer if not already started.

Definition at line 245 of file core.py.

Member Data Documentation

◆ _callback

homeassistant.components.stream.core.IdleTimer._callback
private

Definition at line 241 of file core.py.

◆ _hass

homeassistant.components.stream.core.IdleTimer._hass
private

Definition at line 239 of file core.py.

◆ _timeout

homeassistant.components.stream.core.IdleTimer._timeout
private

Definition at line 240 of file core.py.

◆ _unsub

homeassistant.components.stream.core.IdleTimer._unsub
private

Definition at line 249 of file core.py.

◆ idle

homeassistant.components.stream.core.IdleTimer.idle

Definition at line 243 of file core.py.


The documentation for this class was generated from the following file: