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 StoredEntityfind (std::uint32_t key) const
 
const StoredEntityfind_by_object_id (const std::string &object_id) const
 
std::vector< const StoredEntity * > entities () const
 All tracked entities (unordered).
 
std::optional< BinarySensorInfobinary_sensor_info (std::uint32_t key) const
 
std::optional< BinarySensorStatebinary_sensor_state (std::uint32_t key) const
 
std::optional< SensorInfosensor_info (std::uint32_t key) const
 
std::optional< SensorStatesensor_state (std::uint32_t key) const
 
std::optional< TextSensorInfotext_sensor_info (std::uint32_t key) const
 
std::optional< TextSensorStatetext_sensor_state (std::uint32_t key) const
 
std::optional< SwitchInfoswitch_info (std::uint32_t key) const
 
std::optional< SwitchStateswitch_state (std::uint32_t key) const
 
std::optional< LightInfolight_info (std::uint32_t key) const
 
std::optional< LightStatelight_state (std::uint32_t key) const
 
std::optional< CoverInfocover_info (std::uint32_t key) const
 
std::optional< CoverStatecover_state (std::uint32_t key) const
 
std::optional< FanInfofan_info (std::uint32_t key) const
 
std::optional< FanStatefan_state (std::uint32_t key) const
 
std::optional< ClimateInfoclimate_info (std::uint32_t key) const
 
std::optional< ClimateStateclimate_state (std::uint32_t key) const
 
std::optional< NumberInfonumber_info (std::uint32_t key) const
 
std::optional< NumberStatenumber_state (std::uint32_t key) const
 
std::optional< SelectInfoselect_info (std::uint32_t key) const
 
std::optional< SelectStateselect_state (std::uint32_t key) const
 
std::optional< TextInfotext_info (std::uint32_t key) const
 
std::optional< TextStatetext_state (std::uint32_t key) const
 
std::optional< ButtonInfobutton_info (std::uint32_t key) const
 
std::optional< LockInfolock_info (std::uint32_t key) const
 
std::optional< LockEntityStatelock_state (std::uint32_t key) const
 
std::optional< MediaPlayerInfomedia_player_info (std::uint32_t key) const
 
std::optional< MediaPlayerStatusmedia_player_state (std::uint32_t key) const
 
std::optional< CameraInfocamera_info (std::uint32_t key) const
 
std::optional< SirenInfosiren_info (std::uint32_t key) const
 
std::optional< SirenStatesiren_state (std::uint32_t key) const
 
std::optional< AlarmControlPanelInfoalarm_control_panel_info (std::uint32_t key) const
 
std::optional< AlarmControlPanelStatusalarm_control_panel_state (std::uint32_t key) const
 
std::optional< DateInfodate_info (std::uint32_t key) const
 
std::optional< DateStatedate_state (std::uint32_t key) const
 
std::optional< TimeInfotime_info (std::uint32_t key) const
 
std::optional< TimeStatetime_state (std::uint32_t key) const
 
std::optional< DateTimeInfodatetime_info (std::uint32_t key) const
 
std::optional< DateTimeStatedatetime_state (std::uint32_t key) const
 
std::optional< ValveInfovalve_info (std::uint32_t key) const
 
std::optional< ValveStatevalve_state (std::uint32_t key) const
 
std::optional< EventInfoevent_info (std::uint32_t key) const
 
std::optional< EventStateevent_state (std::uint32_t key) const
 
std::optional< UpdateInfoupdate_info (std::uint32_t key) const
 
std::optional< UpdateStateupdate_state (std::uint32_t key) const
 
std::optional< WaterHeaterInfowater_heater_info (std::uint32_t key) const
 
std::optional< WaterHeaterStatewater_heater_state (std::uint32_t key) const
 
std::optional< InfraredInfoinfrared_info (std::uint32_t key) const
 
std::optional< RadioFrequencyInforadio_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: