|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
Per-hub poll scheduling and failure-backoff policy. More...
#include <status_poll_policy.h>
Public Member Functions | |
| void | set_interval (const std::string &device_id, uint32_t interval_ms) |
| Set the configured follow-up poll interval (ms; 0 = legacy one-shot settle only). | |
| uint32_t | get_interval (const std::string &device_id) const |
| Return the configured interval (0 when not set or unconfigured). | |
| void | begin_tracking (const std::string &device_id, uint32_t initial_delay_ms, uint32_t now) |
| Begin bounded follow-up polling after a command or remote activity. | |
| void | clear (const std::string &device_id) |
| Stop all polling for a device and reset failure counts. Preserves interval_ms. | |
| void | set_next_update (const std::string &device_id, uint32_t abs_time) |
| Schedule the next poll at an absolute millis() timestamp. | |
| uint32_t | get_next_update (const std::string &device_id) const |
| uint32_t | on_exchange_failed (const std::string &device_id, bool auth_like, uint32_t now) |
| Record a failed background poll; apply backoff or clear tracking if the window expired. | |
| void | clear_failure_streaks (const std::string &device_id) |
| Reset failure streaks after a successful exchange response. | |
| uint8_t | get_status_poll_failures (const std::string &device_id) const |
| uint8_t | get_auth_poll_failures (const std::string &device_id) const |
| uint32_t | get_poll_deadline (const std::string &device_id) const |
| bool | is_tracking_active (const std::string &device_id, uint32_t now) const |
| True when the device has an active bounded polling window (deadline set and not expired). | |
| std::optional< std::string > | pop_due_device (uint32_t now) |
| Return and consume the first device whose next_update is overdue. | |
Per-hub poll scheduling and failure-backoff policy.
Maintains a PollTracking entry per device; all hub poll bookkeeping lives here and nowhere else. Callers inject 'now' timestamps so the class is fully testable without a hardware clock.
Definition at line 101 of file status_poll_policy.h.
| void esphome::home_io_control::StatusPollPolicy::begin_tracking | ( | const std::string & | device_id, |
| uint32_t | initial_delay_ms, | ||
| uint32_t | now ) |
Begin bounded follow-up polling after a command or remote activity.
Sets a deadline regardless of whether a configured interval exists; interval-0 devices use device-hinted or default settle delays computed at response time.
Definition at line 19 of file status_poll_policy.cpp.
| void esphome::home_io_control::StatusPollPolicy::clear | ( | const std::string & | device_id | ) |
Stop all polling for a device and reset failure counts. Preserves interval_ms.
Definition at line 27 of file status_poll_policy.cpp.
| void esphome::home_io_control::StatusPollPolicy::clear_failure_streaks | ( | const std::string & | device_id | ) |
Reset failure streaks after a successful exchange response.
Definition at line 89 of file status_poll_policy.cpp.
|
nodiscard |
Definition at line 102 of file status_poll_policy.cpp.
|
nodiscard |
Return the configured interval (0 when not set or unconfigured).
Definition at line 14 of file status_poll_policy.cpp.
|
nodiscard |
Definition at line 43 of file status_poll_policy.cpp.
|
nodiscard |
Definition at line 48 of file status_poll_policy.cpp.
|
nodiscard |
Definition at line 97 of file status_poll_policy.cpp.
|
nodiscard |
True when the device has an active bounded polling window (deadline set and not expired).
Definition at line 53 of file status_poll_policy.cpp.
| uint32_t esphome::home_io_control::StatusPollPolicy::on_exchange_failed | ( | const std::string & | device_id, |
| bool | auth_like, | ||
| uint32_t | now ) |
Record a failed background poll; apply backoff or clear tracking if the window expired.
Returns the backoff delay applied in ms, or 0 if tracking was cleared.
Definition at line 61 of file status_poll_policy.cpp.
|
nodiscard |
Return and consume the first device whose next_update is overdue.
Clears expired tracking entries as a side effect. Returns nullopt if nothing is due.
Definition at line 107 of file status_poll_policy.cpp.
| void esphome::home_io_control::StatusPollPolicy::set_interval | ( | const std::string & | device_id, |
| uint32_t | interval_ms ) |
Set the configured follow-up poll interval (ms; 0 = legacy one-shot settle only).
Definition at line 10 of file status_poll_policy.cpp.
| void esphome::home_io_control::StatusPollPolicy::set_next_update | ( | const std::string & | device_id, |
| uint32_t | abs_time ) |
Schedule the next poll at an absolute millis() timestamp.
Definition at line 39 of file status_poll_policy.cpp.