esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
esphome::api::EntityStore Class Reference

Collects a device's entity descriptions and live states. More...

#include <entity_store.hpp>

Public Types

using StateCallback = std::function< void(EntityType type, std::uint32_t key)>
 

Public Member Functions

bool ingest (const ProtoMessage &msg)
 Ingest one decoded message.
 
void clear ()
 Remove all tracked entities.
 
void on_state (StateCallback cb)
 Fired after each state update.
 
std::size_t size () const noexcept
 
const StoredEntity * find (std::uint32_t key) const
 
const StoredEntity * find_by_object_id (const std::string &object_id) const
 
std::vector< const StoredEntity * > entities () const
 All tracked entities (unordered).
 
std::optional< BinarySensorInfo > binary_sensor_info (std::uint32_t key) const
 
std::optional< BinarySensorState > binary_sensor_state (std::uint32_t key) const
 
std::optional< SensorInfo > sensor_info (std::uint32_t key) const
 
std::optional< SensorState > sensor_state (std::uint32_t key) const
 
std::optional< TextSensorInfo > text_sensor_info (std::uint32_t key) const
 
std::optional< TextSensorState > text_sensor_state (std::uint32_t key) const
 
std::optional< SwitchInfo > switch_info (std::uint32_t key) const
 
std::optional< SwitchState > switch_state (std::uint32_t key) const
 
std::optional< LightInfo > light_info (std::uint32_t key) const
 
std::optional< LightState > light_state (std::uint32_t key) const
 
std::optional< CoverInfo > cover_info (std::uint32_t key) const
 
std::optional< CoverState > cover_state (std::uint32_t key) const
 
std::optional< FanInfo > fan_info (std::uint32_t key) const
 
std::optional< FanState > fan_state (std::uint32_t key) const
 
std::optional< ClimateInfo > climate_info (std::uint32_t key) const
 
std::optional< ClimateState > climate_state (std::uint32_t key) const
 
std::optional< NumberInfo > number_info (std::uint32_t key) const
 
std::optional< NumberState > number_state (std::uint32_t key) const
 
std::optional< SelectInfo > select_info (std::uint32_t key) const
 
std::optional< SelectState > select_state (std::uint32_t key) const
 
std::optional< TextInfo > text_info (std::uint32_t key) const
 
std::optional< TextState > text_state (std::uint32_t key) const
 
std::optional< ButtonInfo > button_info (std::uint32_t key) const
 
std::optional< LockInfo > lock_info (std::uint32_t key) const
 
std::optional< LockEntityState > lock_state (std::uint32_t key) const
 
std::optional< MediaPlayerInfo > media_player_info (std::uint32_t key) const
 
std::optional< MediaPlayerStatus > media_player_state (std::uint32_t key) const
 
std::optional< CameraInfo > camera_info (std::uint32_t key) const
 
std::optional< SirenInfo > siren_info (std::uint32_t key) const
 
std::optional< SirenState > siren_state (std::uint32_t key) const
 
std::optional< AlarmControlPanelInfo > alarm_control_panel_info (std::uint32_t key) const
 
std::optional< AlarmControlPanelStatus > alarm_control_panel_state (std::uint32_t key) const
 
std::optional< DateInfo > date_info (std::uint32_t key) const
 
std::optional< DateState > date_state (std::uint32_t key) const
 
std::optional< TimeInfo > time_info (std::uint32_t key) const
 
std::optional< TimeState > time_state (std::uint32_t key) const
 
std::optional< DateTimeInfo > datetime_info (std::uint32_t key) const
 
std::optional< DateTimeState > datetime_state (std::uint32_t key) const
 
std::optional< ValveInfo > valve_info (std::uint32_t key) const
 
std::optional< ValveState > valve_state (std::uint32_t key) const
 
std::optional< EventInfo > event_info (std::uint32_t key) const
 
std::optional< EventState > event_state (std::uint32_t key) const
 
std::optional< UpdateInfo > update_info (std::uint32_t key) const
 
std::optional< UpdateState > update_state (std::uint32_t key) const
 
std::optional< WaterHeaterInfo > water_heater_info (std::uint32_t key) const
 
std::optional< WaterHeaterState > water_heater_state (std::uint32_t key) const
 
std::optional< InfraredInfo > infrared_info (std::uint32_t key) const
 
std::optional< RadioFrequencyInfo > radio_frequency_info (std::uint32_t key) const
 

Detailed Description

Collects a device's entity descriptions and live states.

Feed every inbound message to ingest(); query with the typed accessors below.

Member Typedef Documentation

◆ StateCallback

using esphome::api::EntityStore::StateCallback = std::function<void(EntityType type, std::uint32_t key)>

Member Function Documentation

◆ alarm_control_panel_info()

std::optional< AlarmControlPanelInfo > esphome::api::EntityStore::alarm_control_panel_info ( std::uint32_t  key) const

◆ alarm_control_panel_state()

std::optional< AlarmControlPanelStatus > esphome::api::EntityStore::alarm_control_panel_state ( std::uint32_t  key) const

◆ binary_sensor_info()

std::optional< BinarySensorInfo > esphome::api::EntityStore::binary_sensor_info ( std::uint32_t  key) const

◆ binary_sensor_state()

std::optional< BinarySensorState > esphome::api::EntityStore::binary_sensor_state ( std::uint32_t  key) const

◆ button_info()

std::optional< ButtonInfo > esphome::api::EntityStore::button_info ( std::uint32_t  key) const

◆ camera_info()

std::optional< CameraInfo > esphome::api::EntityStore::camera_info ( std::uint32_t  key) const

◆ clear()

void esphome::api::EntityStore::clear ( )

Remove all tracked entities.

◆ climate_info()

std::optional< ClimateInfo > esphome::api::EntityStore::climate_info ( std::uint32_t  key) const

◆ climate_state()

std::optional< ClimateState > esphome::api::EntityStore::climate_state ( std::uint32_t  key) const

◆ cover_info()

std::optional< CoverInfo > esphome::api::EntityStore::cover_info ( std::uint32_t  key) const

◆ cover_state()

std::optional< CoverState > esphome::api::EntityStore::cover_state ( std::uint32_t  key) const

◆ date_info()

std::optional< DateInfo > esphome::api::EntityStore::date_info ( std::uint32_t  key) const

◆ date_state()

std::optional< DateState > esphome::api::EntityStore::date_state ( std::uint32_t  key) const

◆ datetime_info()

std::optional< DateTimeInfo > esphome::api::EntityStore::datetime_info ( std::uint32_t  key) const

◆ datetime_state()

std::optional< DateTimeState > esphome::api::EntityStore::datetime_state ( std::uint32_t  key) const

◆ entities()

std::vector< const StoredEntity * > esphome::api::EntityStore::entities ( ) const

All tracked entities (unordered).

◆ event_info()

std::optional< EventInfo > esphome::api::EntityStore::event_info ( std::uint32_t  key) const

◆ event_state()

std::optional< EventState > esphome::api::EntityStore::event_state ( std::uint32_t  key) const

◆ fan_info()

std::optional< FanInfo > esphome::api::EntityStore::fan_info ( std::uint32_t  key) const

◆ fan_state()

std::optional< FanState > esphome::api::EntityStore::fan_state ( std::uint32_t  key) const

◆ find()

const StoredEntity * esphome::api::EntityStore::find ( std::uint32_t  key) const

◆ find_by_object_id()

const StoredEntity * esphome::api::EntityStore::find_by_object_id ( const std::string &  object_id) const

◆ infrared_info()

std::optional< InfraredInfo > esphome::api::EntityStore::infrared_info ( std::uint32_t  key) const

◆ ingest()

bool esphome::api::EntityStore::ingest ( const ProtoMessage &  msg)

Ingest one decoded message.

ListEntities*Response populates entity info; *StateResponse (and EventResponse) updates state and fires on_state. Returns true if the message was an entity info/state message.

◆ light_info()

std::optional< LightInfo > esphome::api::EntityStore::light_info ( std::uint32_t  key) const

◆ light_state()

std::optional< LightState > esphome::api::EntityStore::light_state ( std::uint32_t  key) const

◆ lock_info()

std::optional< LockInfo > esphome::api::EntityStore::lock_info ( std::uint32_t  key) const

◆ lock_state()

std::optional< LockEntityState > esphome::api::EntityStore::lock_state ( std::uint32_t  key) const

◆ media_player_info()

std::optional< MediaPlayerInfo > esphome::api::EntityStore::media_player_info ( std::uint32_t  key) const

◆ media_player_state()

std::optional< MediaPlayerStatus > esphome::api::EntityStore::media_player_state ( std::uint32_t  key) const

◆ number_info()

std::optional< NumberInfo > esphome::api::EntityStore::number_info ( std::uint32_t  key) const

◆ number_state()

std::optional< NumberState > esphome::api::EntityStore::number_state ( std::uint32_t  key) const

◆ on_state()

void esphome::api::EntityStore::on_state ( StateCallback  cb)
inline

Fired after each state update.

◆ radio_frequency_info()

std::optional< RadioFrequencyInfo > esphome::api::EntityStore::radio_frequency_info ( std::uint32_t  key) const

◆ select_info()

std::optional< SelectInfo > esphome::api::EntityStore::select_info ( std::uint32_t  key) const

◆ select_state()

std::optional< SelectState > esphome::api::EntityStore::select_state ( std::uint32_t  key) const

◆ sensor_info()

std::optional< SensorInfo > esphome::api::EntityStore::sensor_info ( std::uint32_t  key) const

◆ sensor_state()

std::optional< SensorState > esphome::api::EntityStore::sensor_state ( std::uint32_t  key) const

◆ siren_info()

std::optional< SirenInfo > esphome::api::EntityStore::siren_info ( std::uint32_t  key) const

◆ siren_state()

std::optional< SirenState > esphome::api::EntityStore::siren_state ( std::uint32_t  key) const

◆ size()

std::size_t esphome::api::EntityStore::size ( ) const
inlinenoexcept

◆ switch_info()

std::optional< SwitchInfo > esphome::api::EntityStore::switch_info ( std::uint32_t  key) const

◆ switch_state()

std::optional< SwitchState > esphome::api::EntityStore::switch_state ( std::uint32_t  key) const

◆ text_info()

std::optional< TextInfo > esphome::api::EntityStore::text_info ( std::uint32_t  key) const

◆ text_sensor_info()

std::optional< TextSensorInfo > esphome::api::EntityStore::text_sensor_info ( std::uint32_t  key) const

◆ text_sensor_state()

std::optional< TextSensorState > esphome::api::EntityStore::text_sensor_state ( std::uint32_t  key) const

◆ text_state()

std::optional< TextState > esphome::api::EntityStore::text_state ( std::uint32_t  key) const

◆ time_info()

std::optional< TimeInfo > esphome::api::EntityStore::time_info ( std::uint32_t  key) const

◆ time_state()

std::optional< TimeState > esphome::api::EntityStore::time_state ( std::uint32_t  key) const

◆ update_info()

std::optional< UpdateInfo > esphome::api::EntityStore::update_info ( std::uint32_t  key) const

◆ update_state()

std::optional< UpdateState > esphome::api::EntityStore::update_state ( std::uint32_t  key) const

◆ valve_info()

std::optional< ValveInfo > esphome::api::EntityStore::valve_info ( std::uint32_t  key) const

◆ valve_state()

std::optional< ValveState > esphome::api::EntityStore::valve_state ( std::uint32_t  key) const

◆ water_heater_info()

std::optional< WaterHeaterInfo > esphome::api::EntityStore::water_heater_info ( std::uint32_t  key) const

◆ water_heater_state()

std::optional< WaterHeaterState > esphome::api::EntityStore::water_heater_state ( std::uint32_t  key) const

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