Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
periodic_poll_policy.h File Reference

Schedule and failure bookkeeping for the opt-in periodic polls. More...

#include <cstdint>
#include <map>
#include <optional>
#include <string>
Include dependency graph for periodic_poll_policy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  esphome::home_io_control::PeriodicPollPolicy
 Per-device periodic poll schedule, miss retry and miss counter for one poll kind. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

uint32_t esphome::home_io_control::periodic_poll_first_delay_ms (uint32_t random)
 Delay of a device's first poll after its interval is set.
uint32_t esphome::home_io_control::periodic_poll_jittered_interval_ms (uint32_t interval_ms, uint32_t random)
 One poll interval moved by a uniform offset of up to PERIODIC_POLL_JITTER_PERCENT either way.

Variables

static constexpr uint32_t esphome::home_io_control::PERIODIC_POLL_INITIAL_DELAY_MS = 15000
 Earliest first poll after boot.
static constexpr uint32_t esphome::home_io_control::PERIODIC_POLL_INITIAL_SPREAD_MS = 30000
 Width of the random window added to PERIODIC_POLL_INITIAL_DELAY_MS, so devices do not start in step.
static constexpr uint32_t esphome::home_io_control::PERIODIC_POLL_JITTER_PERCENT = 10
 Per-poll offset, as a percentage of the interval, applied symmetrically around it.
static constexpr uint32_t esphome::home_io_control::PERIODIC_POLL_MOVING_RETRY_MS = 30000
 Delay before asking again when the device is moving.
static constexpr uint32_t esphome::home_io_control::PERIODIC_POLL_MISS_RETRY_MS = 60000
 Delay before asking once more after a poll the device left unanswered (silence, or a challenge with no final answer).
static constexpr uint8_t esphome::home_io_control::PERIODIC_POLL_MAX_TRIES = 2
 Tries per poll.
static constexpr uint8_t esphome::home_io_control::PERIODIC_POLL_FAILURES_BEFORE_UNKNOWN = 3
 Consecutive unanswered polls after which the last reading is no longer usable.

Detailed Description

Schedule and failure bookkeeping for the opt-in periodic polls.

Owns the per-device periodic schedule of one opt-in poll. The hub runs one instance per poll kind: the limitation read behind rain_sensor_poll_interval, the event subscriptions behind sun_level_poll_interval and battery_level_poll_interval (ADR 0050, ADR 0064), and the status read behind status_refresh_interval (ADR 0066). Kept apart from StatusPollPolicy on purpose: that one runs bounded tracking windows which end when a device stops, this one is an unbounded periodic schedule. Pure logic with injected timestamps and random numbers — fully host-testable without a clock or a random source.

Definition in file periodic_poll_policy.h.