ESPHome  2021.11.4
Namespaces | Data Structures | Typedefs | Enumerations | Functions | Variables
esphome::api Namespace Reference

Namespaces

 enums
 

Data Structures

class  APIConnectedCondition
 
class  APIConnection
 
class  APIFrameHelper
 
class  APINoiseContext
 
class  APINoiseFrameHelper
 
class  APIPlaintextFrameHelper
 
class  APIServer
 
class  APIServerConnection
 
class  APIServerConnectionBase
 
class  BinarySensorStateResponse
 
class  CameraImageRequest
 
class  CameraImageResponse
 
class  ClimateCommandRequest
 
class  ClimateStateResponse
 
class  ComponentIterator
 
class  ConnectRequest
 
class  ConnectResponse
 
class  CoverCommandRequest
 
class  CoverStateResponse
 
class  CustomAPIDevice
 
class  CustomAPIDeviceService
 
class  DeviceInfoRequest
 
class  DeviceInfoResponse
 
class  DisconnectRequest
 
class  DisconnectResponse
 
class  ExecuteServiceArgument
 
class  ExecuteServiceRequest
 
class  FanCommandRequest
 
class  FanStateResponse
 
class  GetTimeRequest
 
class  GetTimeResponse
 
class  HelloRequest
 
class  HelloResponse
 
class  HomeAssistantServiceCallAction
 
class  HomeassistantServiceMap
 
class  HomeassistantServiceResponse
 
class  HomeAssistantStateResponse
 
class  InitialStateIterator
 
class  LightCommandRequest
 
class  LightStateResponse
 
class  ListEntitiesBinarySensorResponse
 
class  ListEntitiesCameraResponse
 
class  ListEntitiesClimateResponse
 
class  ListEntitiesCoverResponse
 
class  ListEntitiesDoneResponse
 
class  ListEntitiesFanResponse
 
class  ListEntitiesIterator
 
class  ListEntitiesLightResponse
 
class  ListEntitiesNumberResponse
 
class  ListEntitiesRequest
 
class  ListEntitiesSelectResponse
 
class  ListEntitiesSensorResponse
 
class  ListEntitiesServicesArgument
 
class  ListEntitiesServicesResponse
 
class  ListEntitiesSwitchResponse
 
class  ListEntitiesTextSensorResponse
 
class  NumberCommandRequest
 
class  NumberStateResponse
 
struct  PacketBuffer
 
class  PingRequest
 
class  PingResponse
 
class  Proto32Bit
 
class  Proto64Bit
 
class  ProtoLengthDelimited
 
class  ProtoMessage
 
class  ProtoService
 
class  ProtoVarInt
 Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit. More...
 
class  ProtoWriteBuffer
 
struct  ReadPacketBuffer
 
class  SelectCommandRequest
 
class  SelectStateResponse
 
class  SensorStateResponse
 
class  SubscribeHomeassistantServicesRequest
 
class  SubscribeHomeAssistantStateResponse
 
class  SubscribeHomeAssistantStatesRequest
 
class  SubscribeLogsRequest
 
class  SubscribeLogsResponse
 
class  SubscribeStatesRequest
 
class  SwitchCommandRequest
 
class  SwitchStateResponse
 
class  TemplatableKeyValuePair
 
class  TemplatableStringValue
 
class  TextSensorStateResponse
 
class  UserServiceBase
 
class  UserServiceDescriptor
 
class  UserServiceTrigger
 

Typedefs

using psk_t = std::array< uint8_t, 32 >
 

Enumerations

enum  APIError : int {
  APIError::OK = 0, APIError::WOULD_BLOCK = 1001, APIError::BAD_HANDSHAKE_PACKET_LEN = 1002, APIError::BAD_INDICATOR = 1003,
  APIError::BAD_DATA_PACKET = 1004, APIError::TCP_NODELAY_FAILED = 1005, APIError::TCP_NONBLOCKING_FAILED = 1006, APIError::CLOSE_FAILED = 1007,
  APIError::SHUTDOWN_FAILED = 1008, APIError::BAD_STATE = 1009, APIError::BAD_ARG = 1010, APIError::SOCKET_READ_FAILED = 1011,
  APIError::SOCKET_WRITE_FAILED = 1012, APIError::HANDSHAKESTATE_READ_FAILED = 1013, APIError::HANDSHAKESTATE_WRITE_FAILED = 1014, APIError::HANDSHAKESTATE_BAD_STATE = 1015,
  APIError::CIPHERSTATE_DECRYPT_FAILED = 1016, APIError::CIPHERSTATE_ENCRYPT_FAILED = 1017, APIError::OUT_OF_MEMORY = 1018, APIError::HANDSHAKESTATE_SETUP_FAILED = 1019,
  APIError::HANDSHAKESTATE_SPLIT_FAILED = 1020, APIError::BAD_HANDSHAKE_ERROR_BYTE = 1021, APIError::CONNECTION_CLOSED = 1022
}
 

Functions

std::string get_default_unique_id (const std::string &component_type, EntityBase *entity)
 
bool is_would_block (ssize_t ret)
 Is the given return value (from write syscalls) a wouldblock error? More...
 
const char * api_error_to_str (APIError err)
 
std::string noise_err_to_str (int err)
 Convert a noise error code to a readable error. More...
 
void noise_rand_bytes (void *output, size_t len)
 
template<>
const char * proto_enum_to_string< enums::EntityCategory > (enums::EntityCategory value)
 
template<>
const char * proto_enum_to_string< enums::LegacyCoverState > (enums::LegacyCoverState value)
 
template<>
const char * proto_enum_to_string< enums::CoverOperation > (enums::CoverOperation value)
 
template<>
const char * proto_enum_to_string< enums::LegacyCoverCommand > (enums::LegacyCoverCommand value)
 
template<>
const char * proto_enum_to_string< enums::FanSpeed > (enums::FanSpeed value)
 
template<>
const char * proto_enum_to_string< enums::FanDirection > (enums::FanDirection value)
 
template<>
const char * proto_enum_to_string< enums::ColorMode > (enums::ColorMode value)
 
template<>
const char * proto_enum_to_string< enums::SensorStateClass > (enums::SensorStateClass value)
 
template<>
const char * proto_enum_to_string< enums::SensorLastResetType > (enums::SensorLastResetType value)
 
template<>
const char * proto_enum_to_string< enums::LogLevel > (enums::LogLevel value)
 
template<>
const char * proto_enum_to_string< enums::ServiceArgType > (enums::ServiceArgType value)
 
template<>
const char * proto_enum_to_string< enums::ClimateMode > (enums::ClimateMode value)
 
template<>
const char * proto_enum_to_string< enums::ClimateFanMode > (enums::ClimateFanMode value)
 
template<>
const char * proto_enum_to_string< enums::ClimateSwingMode > (enums::ClimateSwingMode value)
 
template<>
const char * proto_enum_to_string< enums::ClimateAction > (enums::ClimateAction value)
 
template<>
const char * proto_enum_to_string< enums::ClimatePreset > (enums::ClimatePreset value)
 
template<typename T >
const char * proto_enum_to_string (T value)
 
template<>
bool get_execute_arg_value< bool > (const ExecuteServiceArgument &arg)
 
template<>
int get_execute_arg_value< int > (const ExecuteServiceArgument &arg)
 
template<>
float get_execute_arg_value< float > (const ExecuteServiceArgument &arg)
 
template<>
std::string get_execute_arg_value< std::string > (const ExecuteServiceArgument &arg)
 
template<>
std::vector< bool > get_execute_arg_value< std::vector< bool > > (const ExecuteServiceArgument &arg)
 
template<>
std::vector< int32_t > get_execute_arg_value< std::vector< int32_t > > (const ExecuteServiceArgument &arg)
 
template<>
std::vector< float > get_execute_arg_value< std::vector< float > > (const ExecuteServiceArgument &arg)
 
template<>
std::vector< std::string > get_execute_arg_value< std::vector< std::string > > (const ExecuteServiceArgument &arg)
 
template<>
enums::ServiceArgType to_service_arg_type< bool > ()
 
template<>
enums::ServiceArgType to_service_arg_type< int > ()
 
template<>
enums::ServiceArgType to_service_arg_type< float > ()
 
template<>
enums::ServiceArgType to_service_arg_type< std::string > ()
 
template<>
enums::ServiceArgType to_service_arg_type< std::vector< bool > > ()
 
template<>
enums::ServiceArgType to_service_arg_type< std::vector< int > > ()
 
template<>
enums::ServiceArgType to_service_arg_type< std::vector< float > > ()
 
template<>
enums::ServiceArgType to_service_arg_type< std::vector< std::string > > ()
 
template<typename T >
get_execute_arg_value (const ExecuteServiceArgument &arg)
 
template<typename T >
enums::ServiceArgType to_service_arg_type ()
 

Variables

APIServerglobal_api_server = nullptr
 

Typedef Documentation

◆ psk_t

using esphome::api::psk_t = typedef std::array<uint8_t, 32>

Definition at line 10 of file api_noise_context.h.

Enumeration Type Documentation

◆ APIError

enum esphome::api::APIError : int
strong
Enumerator
OK 
WOULD_BLOCK 
BAD_HANDSHAKE_PACKET_LEN 
BAD_INDICATOR 
BAD_DATA_PACKET 
TCP_NODELAY_FAILED 
TCP_NONBLOCKING_FAILED 
CLOSE_FAILED 
SHUTDOWN_FAILED 
BAD_STATE 
BAD_ARG 
SOCKET_READ_FAILED 
SOCKET_WRITE_FAILED 
HANDSHAKESTATE_READ_FAILED 
HANDSHAKESTATE_WRITE_FAILED 
HANDSHAKESTATE_BAD_STATE 
CIPHERSTATE_DECRYPT_FAILED 
CIPHERSTATE_ENCRYPT_FAILED 
OUT_OF_MEMORY 
HANDSHAKESTATE_SETUP_FAILED 
HANDSHAKESTATE_SPLIT_FAILED 
BAD_HANDSHAKE_ERROR_BYTE 
CONNECTION_CLOSED 

Definition at line 33 of file api_frame_helper.h.

Function Documentation

◆ api_error_to_str()

const char * esphome::api::api_error_to_str ( APIError  err)

Definition at line 21 of file api_frame_helper.cpp.

◆ get_default_unique_id()

std::string esphome::api::get_default_unique_id ( const std::string &  component_type,
EntityBase entity 
)

Definition at line 149 of file api_connection.cpp.

◆ get_execute_arg_value()

template<typename T >
T esphome::api::get_execute_arg_value ( const ExecuteServiceArgument arg)

◆ get_execute_arg_value< bool >()

template<>
bool esphome::api::get_execute_arg_value< bool > ( const ExecuteServiceArgument arg)

Definition at line 7 of file user_services.cpp.

◆ get_execute_arg_value< float >()

template<>
float esphome::api::get_execute_arg_value< float > ( const ExecuteServiceArgument arg)

Definition at line 13 of file user_services.cpp.

◆ get_execute_arg_value< int >()

template<>
int esphome::api::get_execute_arg_value< int > ( const ExecuteServiceArgument arg)

Definition at line 8 of file user_services.cpp.

◆ get_execute_arg_value< std::string >()

template<>
std::string esphome::api::get_execute_arg_value< std::string > ( const ExecuteServiceArgument arg)

Definition at line 14 of file user_services.cpp.

◆ get_execute_arg_value< std::vector< bool > >()

template<>
std::vector<bool> esphome::api::get_execute_arg_value< std::vector< bool > > ( const ExecuteServiceArgument arg)

Definition at line 15 of file user_services.cpp.

◆ get_execute_arg_value< std::vector< float > >()

template<>
std::vector<float> esphome::api::get_execute_arg_value< std::vector< float > > ( const ExecuteServiceArgument arg)

Definition at line 21 of file user_services.cpp.

◆ get_execute_arg_value< std::vector< int32_t > >()

template<>
std::vector<int32_t> esphome::api::get_execute_arg_value< std::vector< int32_t > > ( const ExecuteServiceArgument arg)

Definition at line 18 of file user_services.cpp.

◆ get_execute_arg_value< std::vector< std::string > >()

template<>
std::vector<std::string> esphome::api::get_execute_arg_value< std::vector< std::string > > ( const ExecuteServiceArgument arg)

Definition at line 24 of file user_services.cpp.

◆ is_would_block()

bool esphome::api::is_would_block ( ssize_t  ret)

Is the given return value (from write syscalls) a wouldblock error?

Definition at line 14 of file api_frame_helper.cpp.

◆ noise_err_to_str()

std::string esphome::api::noise_err_to_str ( int  err)

Convert a noise error code to a readable error.

Definition at line 81 of file api_frame_helper.cpp.

◆ noise_rand_bytes()

void esphome::api::noise_rand_bytes ( void *  output,
size_t  len 
)

Definition at line 727 of file api_frame_helper.cpp.

◆ proto_enum_to_string()

template<typename T >
const char* esphome::api::proto_enum_to_string ( value)

◆ proto_enum_to_string< enums::ClimateAction >()

Definition at line 229 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ClimateFanMode >()

Definition at line 191 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ClimateMode >()

Definition at line 171 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ClimatePreset >()

Definition at line 247 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ClimateSwingMode >()

Definition at line 215 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ColorMode >()

Definition at line 77 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::CoverOperation >()

Definition at line 31 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::EntityCategory >()

Definition at line 9 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::FanDirection >()

Definition at line 67 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::FanSpeed >()

Definition at line 55 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::LegacyCoverCommand >()

Definition at line 43 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::LegacyCoverState >()

Definition at line 21 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::LogLevel >()

Definition at line 127 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::SensorLastResetType >()

Definition at line 115 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::SensorStateClass >()

Definition at line 103 of file api_pb2.cpp.

◆ proto_enum_to_string< enums::ServiceArgType >()

Definition at line 149 of file api_pb2.cpp.

◆ to_service_arg_type()

template<typename T >
enums::ServiceArgType esphome::api::to_service_arg_type ( )

◆ to_service_arg_type< bool >()

Definition at line 28 of file user_services.cpp.

◆ to_service_arg_type< float >()

Definition at line 30 of file user_services.cpp.

◆ to_service_arg_type< int >()

Definition at line 29 of file user_services.cpp.

◆ to_service_arg_type< std::string >()

Definition at line 31 of file user_services.cpp.

◆ to_service_arg_type< std::vector< bool > >()

template<>
enums::ServiceArgType esphome::api::to_service_arg_type< std::vector< bool > > ( )

Definition at line 32 of file user_services.cpp.

◆ to_service_arg_type< std::vector< float > >()

template<>
enums::ServiceArgType esphome::api::to_service_arg_type< std::vector< float > > ( )

Definition at line 34 of file user_services.cpp.

◆ to_service_arg_type< std::vector< int > >()

template<>
enums::ServiceArgType esphome::api::to_service_arg_type< std::vector< int > > ( )

Definition at line 33 of file user_services.cpp.

◆ to_service_arg_type< std::vector< std::string > >()

template<>
enums::ServiceArgType esphome::api::to_service_arg_type< std::vector< std::string > > ( )

Definition at line 37 of file user_services.cpp.

Variable Documentation

◆ global_api_server

APIServer * esphome::api::global_api_server = nullptr

Definition at line 264 of file api_server.cpp.