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

Schedule and failure bookkeeping for the opt-in rain sensor poll. More...

#include <cstdint>
#include <map>
#include <optional>
#include <string>
Include dependency graph for rain_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::RainPollPolicy
 Per-device periodic limitation-read schedule and miss counter. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

uint32_t esphome::home_io_control::rain_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::rain_poll_jittered_interval_ms (uint32_t interval_ms, uint32_t random)
 One poll interval moved by a uniform offset of up to RAIN_POLL_JITTER_PERCENT either way.

Variables

static constexpr uint32_t esphome::home_io_control::RAIN_POLL_INITIAL_DELAY_MS = 15000
 Earliest first poll after boot.
static constexpr uint32_t esphome::home_io_control::RAIN_POLL_INITIAL_SPREAD_MS = 30000
 Width of the random window added to RAIN_POLL_INITIAL_DELAY_MS, so devices do not start in step.
static constexpr uint32_t esphome::home_io_control::RAIN_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::RAIN_POLL_MOVING_RETRY_MS = 30000
 Delay before asking again when the device is moving.
static constexpr uint8_t esphome::home_io_control::RAIN_POLL_MAX_TRIES = 2
 Tries per poll.
static constexpr uint8_t esphome::home_io_control::RAIN_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 rain sensor poll.

Owns the per-device periodic schedule of the limitation read behind rain_sensor_poll_interval. 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 rain_poll_policy.h.