Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
esphome::home_io_control::OptimisticState Struct Reference

What the hub predicted ahead of confirmation, kept apart from what the device reported. More...

#include <proto_device_model.h>

Collaboration diagram for esphome::home_io_control::OptimisticState:

Public Types

enum class  Motion : uint8_t { NONE = 0 , MOVING , STOPPED }
 Predicted movement. More...

Public Member Functions

bool empty () const
void clear ()
 Withdraw every prediction.
void clear_position ()
 Withdraw the position prediction; call when a decoded position observation supersedes it.
void clear_tilt ()
 Withdraw the tilt prediction; call when a decoded tilt observation supersedes it.

Public Attributes

float target {UNKNOWN_POSITION}
 Predicted main-position target, or UNKNOWN_POSITION.
float tilt {UNKNOWN_POSITION}
 Predicted slat angle, or UNKNOWN_POSITION.
Motion motion {Motion::NONE}
 Predicted movement state.

Detailed Description

What the hub predicted ahead of confirmation, kept apart from what the device reported.

The observed fields on IoDevice (position, target, tilt, is_stopped) mean "this is what the device last told us" and are never written by a guess. Anything the hub predicts — to give the Home Assistant UI immediate feedback across the queue-dispatch and exchange gap — lands here instead, so it can be withdrawn when the command that produced it fails (DeviceRegistry::rollback_optimistic()) without risking a real observation.

Consumers read through effective_target() / effective_tilt() / effective_is_stopped() rather than either set of fields directly.

Definition at line 278 of file proto_device_model.h.

Member Enumeration Documentation

◆ Motion

Predicted movement.

NONE defers to the observed is_stopped; a bool could not express "predict stopped" (apply_optimistic_stop) distinctly from "no prediction".

Enumerator
NONE 

No movement prediction; the observed is_stopped decides.

MOVING 

Predicted to be travelling (a position command was issued).

STOPPED 

Predicted to be at rest (a STOP was issued).

Definition at line 281 of file proto_device_model.h.

Member Function Documentation

◆ clear()

void esphome::home_io_control::OptimisticState::clear ( )
inline

Withdraw every prediction.

Definition at line 296 of file proto_device_model.h.

◆ clear_position()

void esphome::home_io_control::OptimisticState::clear_position ( )
inline

Withdraw the position prediction; call when a decoded position observation supersedes it.

Clears motion with target because apply_optimistic_target() sets the two together.

Definition at line 299 of file proto_device_model.h.

◆ clear_tilt()

void esphome::home_io_control::OptimisticState::clear_tilt ( )
inline

Withdraw the tilt prediction; call when a decoded tilt observation supersedes it.

Definition at line 304 of file proto_device_model.h.

◆ empty()

bool esphome::home_io_control::OptimisticState::empty ( ) const
inlinenodiscard
Returns
true when nothing is predicted, so a rollback would be a no-op.

Definition at line 292 of file proto_device_model.h.

Member Data Documentation

◆ motion

Motion esphome::home_io_control::OptimisticState::motion {Motion::NONE}

Predicted movement state.

Definition at line 289 of file proto_device_model.h.

◆ target

float esphome::home_io_control::OptimisticState::target {UNKNOWN_POSITION}

Predicted main-position target, or UNKNOWN_POSITION.

Definition at line 287 of file proto_device_model.h.

◆ tilt

float esphome::home_io_control::OptimisticState::tilt {UNKNOWN_POSITION}

Predicted slat angle, or UNKNOWN_POSITION.

Definition at line 288 of file proto_device_model.h.


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