Public Member Functions | |
| None | __init__ (self, HomeAssistant hass, Logger logger, *float cooldown, bool immediate, Callable[[], _R_co]|None function=None, bool background=False) |
| None | async_call (self) |
| None | async_cancel (self) |
| None | async_schedule_call (self) |
| None | async_shutdown (self) |
| Callable[[], _R_co]|None | function (self) |
| None | function (self, Callable[[], _R_co] function) |
Public Attributes | |
| cooldown | |
| hass | |
| immediate | |
| logger | |
Private Member Functions | |
| bool | _async_schedule_or_call_now (self) |
| None | _handle_timer_finish (self) |
| None | _on_debounce (self) |
| None | _schedule_timer (self) |
Private Attributes | |
| _background | |
| _execute_at_end_of_timer | |
| _execute_lock | |
| _function | |
| _job | |
| _shutdown_requested | |
| _timer_task | |
Class to rate limit calls to a specific command.
Definition at line 12 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.__init__ | ( | self, | |
| HomeAssistant | hass, | ||
| Logger | logger, | ||
| *float | cooldown, | ||
| bool | immediate, | ||
| Callable[[], _R_co] | None | function = None, |
||
| bool | background = False |
||
| ) |
Initialize debounce.
immediate: indicate if the function needs to be called right away and
wait <cooldown> until executing next invocation.
function: optional and can be instantiated later.
Definition at line 15 of file debounce.py.
|
private |
Check if a call should be scheduled. Returns True if the function should be called immediately. Returns False if there is nothing to do.
Definition at line 71 of file debounce.py.
|
private |
Handle a finished timer.
Definition at line 118 of file debounce.py.
|
private |
Create job task, but only if pending.
Definition at line 160 of file debounce.py.
|
private |
Schedule a timer.
Definition at line 177 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.async_call | ( | self | ) |
Call the function.
Reimplemented in homeassistant.components.rabbitair.coordinator.RabbitAirDebouncer.
Definition at line 99 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.async_cancel | ( | self | ) |
Cancel any scheduled call.
Definition at line 151 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.async_schedule_call | ( | self | ) |
Schedule a call to the function.
Definition at line 65 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.async_shutdown | ( | self | ) |
Cancel any scheduled call, and prevent new runs.
Definition at line 145 of file debounce.py.
| Callable[[], _R_co] | None homeassistant.helpers.debounce.Debouncer.function | ( | self | ) |
Return the function being wrapped by the Debouncer.
Definition at line 50 of file debounce.py.
| None homeassistant.helpers.debounce.Debouncer.function | ( | self, | |
| Callable[[], _R_co] | function | ||
| ) |
Update the function being wrapped by the Debouncer.
Definition at line 55 of file debounce.py.
|
private |
Definition at line 39 of file debounce.py.
|
private |
Definition at line 68 of file debounce.py.
|
private |
Definition at line 38 of file debounce.py.
|
private |
Definition at line 33 of file debounce.py.
|
private |
Definition at line 59 of file debounce.py.
|
private |
Definition at line 47 of file debounce.py.
|
private |
Definition at line 155 of file debounce.py.
| homeassistant.helpers.debounce.Debouncer.cooldown |
Definition at line 34 of file debounce.py.
| homeassistant.helpers.debounce.Debouncer.hass |
Definition at line 31 of file debounce.py.
| homeassistant.helpers.debounce.Debouncer.immediate |
Definition at line 35 of file debounce.py.
| homeassistant.helpers.debounce.Debouncer.logger |
Definition at line 32 of file debounce.py.