ESPHome  2022.9.3
Namespaces | Data Structures | Typedefs | Enumerations | Functions | Variables
esphome Namespace Reference

Namespaces

 a4988
 
 ac_dimmer
 
 adalight
 
 adc
 
 addressable_light
 
 ade7953
 
 ads1115
 
 aht10
 
 airthings_ble
 
 airthings_wave_mini
 
 airthings_wave_plus
 
 am2320
 
 am43
 
 analog_threshold
 
 anova
 
 apds9960
 
 api
 
 as3935
 
 as3935_i2c
 
 as3935_spi
 
 atc_mithermometer
 
 atm90e32
 
 b_parasite
 
 ballu
 
 bang_bang
 
 bedjet
 
 bh1750
 
 binary
 
 binary_sensor
 
 binary_sensor_map
 
 bl0939
 
 bl0940
 
 bl0942
 
 ble_client
 
 ble_presence
 
 ble_rssi
 
 ble_scanner
 
 bluetooth_proxy
 
 bme280
 
 bme680
 
 bme680_bsec
 
 bmp085
 
 bmp280
 
 bmp3xx
 
 button
 
 canbus
 
 cap1188
 
 captive_portal
 
 ccs811
 
 cd74hc4067
 
 climate
 
 climate_ir
 
 climate_ir_lg
 
 color_temperature
 
 coolix
 
 copy
 
 cover
 
 cs5460a
 
 cse7761
 
 cse7766
 
 ct_clamp
 
 current_based
 
 custom
 
 custom_component
 
 cwww
 
 dac7678
 
 daikin
 
 dallas
 
 daly_bms
 
 dashboard_import
 
 debug
 
 deep_sleep
 
 delonghi
 
 demo
 
 dfplayer
 
 dht
 
 dht12
 
 display
 
 dps310
 
 ds1307
 
 dsmr
 
 duty_cycle
 
 e131
 
 ektf2232
 
 endstop
 
 ens210
 
 esp32
 
 esp32_ble
 
 esp32_ble_beacon
 
 esp32_ble_client
 
 esp32_ble_server
 
 esp32_ble_tracker
 
 esp32_camera
 
 esp32_camera_web_server
 
 esp32_can
 
 esp32_dac
 
 esp32_hall
 
 esp32_improv
 
 esp32_touch
 
 esp8266
 
 esp8266_pwm
 
 ethernet
 
 exposure_notifications
 
 ezo
 
 factory_reset
 
 fan
 
 fastled_base
 
 feedback
 
 fingerprint_grow
 
 fujitsu_general
 
 globals
 
 gpio
 
 gps
 
 graph
 
 growatt_solar
 
 havells_solar
 
 hbridge
 
 hdc1080
 
 heatpumpir
 
 hitachi_ac344
 
 hitachi_ac424
 
 hlw8012
 
 hm3301
 
 hmc5883l
 
 homeassistant
 
 honeywellabp
 
 hrxl_maxsonar_wr
 
 http_request
 
 htu21d
 
 hx711
 
 hydreon_rgxx
 
 i2c
 
 i2s_audio
 
 ili9341
 
 improv_serial
 
 ina219
 
 ina226
 
 ina260
 
 ina3221
 
 inkbird_ibsth1_mini
 
 inkplate6
 
 integration
 
 internal
 
 interval
 
 json
 
 kalman_combinator
 
 lcd_base
 
 lcd_gpio
 
 lcd_pcf8574
 
 ledc
 
 light
 
 lilygo_t5_47
 
 lock
 
 logger
 
 ltr390
 
 max31855
 
 max31856
 
 max31865
 
 max44009
 
 max6675
 
 max7219
 
 max7219digit
 
 max9611
 
 mcp23008
 
 mcp23016
 
 mcp23017
 
 mcp23s08
 
 mcp23s17
 
 mcp23x08_base
 
 mcp23x17_base
 
 mcp23xxx_base
 
 mcp2515
 
 mcp3008
 
 mcp3204
 
 mcp4725
 
 mcp4728
 
 mcp47a1
 
 mcp9600
 
 mcp9808
 
 md5
 
 mdns
 
 media_player
 
 mhz19
 
 midea
 
 midea_ir
 
 mitsubishi
 
 mlx90393
 
 modbus
 
 modbus_controller
 
 monochromatic
 
 mopeka_ble
 
 mopeka_pro_check
 
 mpl3115a2
 
 mpr121
 
 mpu6050
 
 mpu6886
 
 mqtt
 
 
 ms5611
 
 my9231
 
 neopixelbus
 
 network
 
 nextion
 
 nfc
 
 ntc
 
 number
 
 ota
 
 output
 
 partition
 
 pca9685
 
 pcd8544
 
 pcf8574
 
 pid
 
 pipsolar
 
 pm1006
 
 pmsa003i
 
 pmsx003
 
 pn532
 
 pn532_i2c
 
 pn532_spi
 
 power_supply
 
 preferences
 
 prometheus
 
 psram
 
 pulse_counter
 
 pulse_meter
 
 pulse_width
 
 pvvx_mithermometer
 
 pzem004t
 
 pzemac
 
 pzemdc
 
 qmc5883l
 
 qmp6988
 
 qr_code
 
 radon_eye_ble
 
 radon_eye_rd200
 
 rc522
 
 rc522_i2c
 
 rc522_spi
 Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by .
 
 rdm6300
 
 remote_base
 
 remote_receiver
 
 remote_transmitter
 
 resistance
 
 restart
 
 rf_bridge
 
 rgb
 
 rgbct
 
 rgbw
 
 rgbww
 
 rotary_encoder
 
 rtttl
 
 ruuvi_ble
 
 ruuvitag
 
 safe_mode
 
 scd30
 
 scd4x
 
 script
 
 sdm_meter
 
 sdp3x
 
 sds011
 
 selec_meter
 
 select
 
 sen5x
 
 senseair
 
 sensirion_common
 
 sensor
 
 servo
 
 setup_priority
 Default setup priorities for components of different types.
 
 sgp30
 
 sgp4x
 
 shelly_dimmer
 
 sht3xd
 
 sht4x
 
 shtcx
 
 shutdown
 
 sim800l
 
 slow_pwm
 
 sm16716
 
 sm2135
 
 sm300d2
 
 sml
 
 smt100
 
 sn74hc595
 
 sntp
 
 socket
 
 sonoff_d1
 
 speed
 
 spi
 
 sprinkler
 
 sps30
 
 ssd1306_base
 
 ssd1306_i2c
 
 ssd1306_spi
 
 ssd1322_base
 
 ssd1322_spi
 
 ssd1325_base
 
 ssd1325_spi
 
 ssd1327_base
 
 ssd1327_i2c
 
 ssd1327_spi
 
 ssd1331_base
 
 ssd1331_spi
 
 ssd1351_base
 
 ssd1351_spi
 
 st7735
 
 st7789v
 
 st7920
 
 status
 
 status_led
 
 stepper
 
 sts3x
 
 sun
 
 switch_
 
 sx1509
 Here you'll find the Arduino code used to interface with the SX1509 I2C 16 I/O expander.
 
 t6615
 
 tca9548a
 
 tcl112
 
 tcs34725
 
 teleinfo
 
 template_
 
 text_sensor
 
 thermostat
 
 time
 
 time_based
 
 tlc59208f
 
 tlc5947
 
 tm1621
 
 tm1637
 
 tm1638
 
 tm1651
 
 tmp102
 
 tmp117
 
 tof10120
 
 toshiba
 
 total_daily_energy
 
 touchscreen
 
 tsl2561
 
 tsl2591
 
 ttp229_bsf
 
 ttp229_lsf
 
 tuya
 
 tx20
 
 uart
 
 ufire_ec
 
 ufire_ise
 
 uln2003
 
 ultrasonic
 
 uptime
 
 version
 
 vl53l0x
 
 voltage_sampler
 
 wake_on_lan
 
 waveshare_epaper
 
 web_server
 
 web_server_base
 
 whirlpool
 
 whynter
 
 wifi
 
 wifi_info
 
 wifi_signal
 
 wled
 
 xiaomi_ble
 
 xiaomi_cgd1
 
 xiaomi_cgdk2
 
 xiaomi_cgg1
 
 xiaomi_cgpr1
 
 xiaomi_gcls002
 
 xiaomi_hhccjcy01
 
 xiaomi_hhccpot002
 
 xiaomi_jqjcy01ym
 
 xiaomi_lywsd02
 
 xiaomi_lywsd03mmc
 
 xiaomi_lywsdcgq
 
 xiaomi_mhoc303
 
 xiaomi_mhoc401
 
 xiaomi_miscale
 
 xiaomi_mjyd02yla
 
 xiaomi_mue4094rt
 
 xiaomi_rtcgq02lm
 
 xiaomi_wx08zm
 
 xpt2046
 
 yashima
 
 zyaura
 

Data Structures

class  Action
 
class  ActionList
 
class  AndCondition
 
class  Application
 
class  Automation
 
class  CallbackManager
 
class  CallbackManager< void(Ts...)>
 Helper class to allow having multiple subscribers to a callback. More...
 
struct  Color
 
class  Component
 
class  ComponentIterator
 
class  Condition
 Base class for all automation conditions. More...
 
class  Controller
 
class  Deduplicator
 Helper class to deduplicate items in a series of values. More...
 
class  DelayAction
 
class  EntityBase
 
class  ESPPreferenceBackend
 
class  ESPPreferenceObject
 
class  ESPPreferences
 
class  ExternalRAMAllocator
 An STL allocator that uses SPI RAM. More...
 
class  ForCondition
 
struct  gens
 
struct  gens< 0, S... >
 
class  GPIOPin
 
class  HighFrequencyLoopRequester
 Helper class to request loop() to be called as fast as possible. More...
 
class  IfAction
 
struct  int24_t
 24-bit signed integer type, transparently converting to 32-bit. More...
 
class  InternalGPIOPin
 
class  InterruptLock
 Helper class to disable interrupts. More...
 
struct  is_invocable
 
struct  is_trivially_copyable
 
class  ISRInternalGPIOPin
 Copy of GPIOPin that is safe to use from ISRs (with no virtual functions) More...
 
class  LambdaAction
 
class  LambdaCondition
 
class  LoopTrigger
 
class  NotCondition
 
struct  nullopt_t
 
class  optional
 
class  OrCondition
 
class  Parented
 Helper class to easily give an object a parent of type T. More...
 
class  PollingComponent
 This class simplifies creating components that periodically check a state. More...
 
class  RepeatAction
 
class  Scheduler
 
struct  seq
 
class  ShutdownTrigger
 
class  StartupTrigger
 
class  TemplatableValue
 
class  Trigger
 
struct  uint24_t
 24-bit unsigned integer type, transparently converting to 32-bit. More...
 
class  UpdateComponentAction
 
class  WaitUntilAction
 
class  WarnIfComponentBlockingGuard
 
class  WhileAction
 

Typedefs

using uint64_be_t = internal::BigEndianLayout< uint64_t >
 
using uint32_be_t = internal::BigEndianLayout< uint32_t >
 
using uint24_be_t = internal::BigEndianLayout< uint24_t >
 
using uint16_be_t = internal::BigEndianLayout< uint16_t >
 
using int64_be_t = internal::BigEndianLayout< int64_t >
 
using int32_be_t = internal::BigEndianLayout< int32_t >
 
using int24_be_t = internal::BigEndianLayout< int24_t >
 
using int16_be_t = internal::BigEndianLayout< int16_t >
 
using uint64_le_t = internal::LittleEndianLayout< uint64_t >
 
using uint32_le_t = internal::LittleEndianLayout< uint32_t >
 
using uint24_le_t = internal::LittleEndianLayout< uint24_t >
 
using uint16_le_t = internal::LittleEndianLayout< uint16_t >
 
using int64_le_t = internal::LittleEndianLayout< int64_t >
 
using int32_le_t = internal::LittleEndianLayout< int32_t >
 
using int24_le_t = internal::LittleEndianLayout< int24_t >
 
using int16_le_t = internal::LittleEndianLayout< int16_t >
 

Enumerations

enum  RetryResult { RetryResult::DONE, RetryResult::RETRY }
 
enum  EntityCategory : uint8_t { ENTITY_CATEGORY_NONE = 0, ENTITY_CATEGORY_CONFIG = 1, ENTITY_CATEGORY_DIAGNOSTIC = 2 }
 

Functions

void IRAM_ATTR HOT yield ()
 
uint32_t IRAM_ATTR HOT millis ()
 
void IRAM_ATTR HOT delay (uint32_t ms)
 
uint32_t IRAM_ATTR HOT micros ()
 
void IRAM_ATTR HOT delayMicroseconds (uint32_t us)
 
void arch_restart ()
 
void arch_init ()
 
void IRAM_ATTR HOT arch_feed_wdt ()
 
uint8_t progmem_read_byte (const uint8_t *addr)
 
uint32_t arch_get_cpu_cycle_count ()
 
uint32_t arch_get_cpu_freq_hz ()
 
void loop_task (void *pv_params)
 
void app_main ()
 
void init ()
 
void force_link_symbols ()
 
void resetPins ()
 
 ESPDEPRECATED ("Use Color::BLACK instead of COLOR_BLACK", "v1.21") extern const Color COLOR_BLACK
 
 ESPDEPRECATED ("Use Color::WHITE instead of COLOR_WHITE", "v1.21") extern const Color COLOR_WHITE
 
struct esphome::uint24_t __attribute__ ((packed))
 
void __attribute__ ((noreturn)) arch_restart()
 
template<int(*)(int) fn>
std::string str_ctype_transform (const std::string &str)
 
std::string str_snprintf (const char *fmt, size_t len,...)
 
std::string str_sprintf (const char *fmt,...)
 
void HOT esp_log_printf_ (int level, const char *tag, int line, const char *format,...)
 
void HOT esp_log_printf_ (int level, const char *tag, int line, const __FlashStringHelper *format,...)
 
void HOT esp_log_vprintf_ (int level, const char *tag, int line, const char *format, va_list args)
 
void HOT esp_log_vprintf_ (int level, const char *tag, int line, const __FlashStringHelper *format, va_list args)
 
int HOT esp_idf_log_vprintf_ (const char *format, va_list args)
 
const nullopt_t nullopt ((nullopt_t::init()))
 
template<typename T , typename U >
bool operator== (optional< T > const &x, optional< U > const &y)
 
template<typename T , typename U >
bool operator!= (optional< T > const &x, optional< U > const &y)
 
template<typename T , typename U >
bool operator< (optional< T > const &x, optional< U > const &y)
 
template<typename T , typename U >
bool operator> (optional< T > const &x, optional< U > const &y)
 
template<typename T , typename U >
bool operator<= (optional< T > const &x, optional< U > const &y)
 
template<typename T , typename U >
bool operator>= (optional< T > const &x, optional< U > const &y)
 
template<typename T >
bool operator== (optional< T > const &x, nullopt_t)
 
template<typename T >
bool operator== (nullopt_t, optional< T > const &x)
 
template<typename T >
bool operator!= (optional< T > const &x, nullopt_t)
 
template<typename T >
bool operator!= (nullopt_t, optional< T > const &x)
 
template<typename T >
bool operator< (optional< T > const &, nullopt_t)
 
template<typename T >
bool operator< (nullopt_t, optional< T > const &x)
 
template<typename T >
bool operator<= (optional< T > const &x, nullopt_t)
 
template<typename T >
bool operator<= (nullopt_t, optional< T > const &)
 
template<typename T >
bool operator> (optional< T > const &x, nullopt_t)
 
template<typename T >
bool operator> (nullopt_t, optional< T > const &)
 
template<typename T >
bool operator>= (optional< T > const &, nullopt_t)
 
template<typename T >
bool operator>= (nullopt_t, optional< T > const &x)
 
template<typename T , typename U >
bool operator== (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator== (U const &v, optional< T > const &x)
 
template<typename T , typename U >
bool operator!= (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator!= (U const &v, optional< T > const &x)
 
template<typename T , typename U >
bool operator< (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator< (U const &v, optional< T > const &x)
 
template<typename T , typename U >
bool operator<= (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator<= (U const &v, optional< T > const &x)
 
template<typename T , typename U >
bool operator> (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator> (U const &v, optional< T > const &x)
 
template<typename T , typename U >
bool operator>= (optional< T > const &x, U const &v)
 
template<typename T , typename U >
bool operator>= (U const &v, optional< T > const &x)
 
template<typename T >
void swap (optional< T > &x, optional< T > &y)
 
template<typename T >
optional< T > make_optional (T const &v)
 
bool api_is_connected ()
 Return whether the node has at least one client connected to the native API. More...
 
bool mqtt_is_connected ()
 Return whether the node has an active connection to an MQTT broker. More...
 
bool remote_is_connected ()
 Return whether the node has any form of "remote" connection via the API or to an MQTT broker. More...
 
Mathematics
float lerp (float completion, float start, float end)
 Linearly interpolate between start and end by completion (between 0 and 1). More...
 
uint8_t crc8 (uint8_t *data, uint8_t len)
 Calculate a CRC-8 checksum of data with size len. More...
 
uint16_t crc16 (const uint8_t *data, uint8_t len)
 Calculate a CRC-16 checksum of data with size len. More...
 
uint32_t fnv1_hash (const std::string &str)
 Calculate a FNV-1 hash of str. More...
 
uint32_t random_uint32 ()
 Return a random 32-bit unsigned integer. More...
 
float random_float ()
 Return a random float between 0 and 1. More...
 
bool random_bytes (uint8_t *data, size_t len)
 Generate len number of random bytes. More...
 
template<typename T , typename U >
remap (U value, U min, U max, T min_out, T max_out)
 Remap value from the range (min, max) to (min_out, max_out). More...
 
Colors
float gamma_correct (float value, float gamma)
 Applies gamma correction of gamma to value. More...
 
float gamma_uncorrect (float value, float gamma)
 Reverts gamma correction of gamma to value. More...
 
void rgb_to_hsv (float red, float green, float blue, int &hue, float &saturation, float &value)
 Convert red, green and blue (all 0-1) values to hue (0-360), saturation (0-1) and value (0-1). More...
 
void hsv_to_rgb (int hue, float saturation, float value, float &red, float &green, float &blue)
 Convert hue (0-360), saturation (0-1) and value (0-1) to red, green and blue (all 0-1). More...
 
System APIs
void get_mac_address_raw (uint8_t *mac)
 Get the device MAC address as raw bytes, written into the provided byte array (6 bytes). More...
 
std::string get_mac_address ()
 Get the device MAC address as a string, in lowercase hex notation. More...
 
std::string get_mac_address_pretty ()
 Get the device MAC address as a string, in colon-separated uppercase hex notation. More...
 
void set_mac_address (uint8_t *mac)
 Set the MAC address to use from the provided byte array (6 bytes). More...
 
void delay_microseconds_safe (uint32_t us)
 Delay for the given amount of microseconds, possibly yielding to other processes during the wait. More...
 
Bit manipulation
constexpr uint16_t encode_uint16 (uint8_t msb, uint8_t lsb)
 Encode a 16-bit value given the most and least significant byte. More...
 
constexpr uint32_t encode_uint32 (uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
 Encode a 32-bit value given four bytes in most to least significant byte order. More...
 
constexpr uint32_t encode_uint24 (uint8_t byte1, uint8_t byte2, uint8_t byte3)
 Encode a 24-bit value given three bytes in most to least significant byte order. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 T encode_value (const uint8_t *bytes)
 Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T). More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 T encode_value (const std::array< uint8_t, sizeof(T)> bytes)
 Encode a value from its constituent bytes (from most to least significant) in an std::array with length sizeof(T). More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 std::array< uint8_t, sizeof(T)> decode_value (T val)
 Decode a value into its constituent bytes (from most to least significant). More...
 
uint8_t reverse_bits (uint8_t x)
 Reverse the order of 8 bits. More...
 
uint16_t reverse_bits (uint16_t x)
 Reverse the order of 16 bits. More...
 
uint32_t reverse_bits (uint32_t x)
 Reverse the order of 32 bits. More...
 
template<typename T >
constexpr14 T convert_big_endian (T val)
 Convert a value between host byte order and big endian (most significant byte first) order. More...
 
template<typename T >
constexpr14 T convert_little_endian (T val)
 Convert a value between host byte order and little endian (least significant byte first) order. More...
 
Units
constexpr float celsius_to_fahrenheit (float value)
 Convert degrees Celsius to degrees Fahrenheit. More...
 
constexpr float fahrenheit_to_celsius (float value)
 Convert degrees Fahrenheit to degrees Celsius. More...
 
Internal functions
template<typename T , enable_if_t<!std::is_pointer< T >::value, int > = 0>
id (T value)
 Helper function to make id(var) known from lambdas work in custom components. More...
 
template<typename T , enable_if_t< std::is_pointer< T *>::value, int > = 0>
T & id (T *value)
 Helper function to make id(var) known from lambdas work in custom components. More...
 
Deprecated functions
 ESPDEPRECATED ("hexencode() is deprecated, use format_hex_pretty() instead.", "2022.1") inline std
 

Variables

TaskHandle_t loop_task_handle = nullptr
 
ESPPreferencesglobal_preferences
 
Application App
 Global storage of Application pointer - only one Application can exist. More...
 
const Color COLOR_BLACK (0, 0, 0, 0)
 
const Color COLOR_WHITE (255, 255, 255, 255)
 
const uint32_t COMPONENT_STATE_MASK = 0xFF
 
const uint32_t COMPONENT_STATE_CONSTRUCTION = 0x00
 
const uint32_t COMPONENT_STATE_SETUP = 0x01
 
const uint32_t COMPONENT_STATE_LOOP = 0x02
 
const uint32_t COMPONENT_STATE_FAILED = 0x03
 
const uint32_t STATUS_LED_MASK = 0xFF00
 
const uint32_t STATUS_LED_OK = 0x0000
 
const uint32_t STATUS_LED_WARNING = 0x0100
 
const uint32_t STATUS_LED_ERROR = 0x0200
 
uint32_t global_state = 0
 
enum esphome::EntityCategory __attribute__
 

STL backports

template<bool B, class T = void>
using enable_if_t = typename std::enable_if< B, T >::type
 
std::string to_string (int value)
 
std::string to_string (long value)
 
std::string to_string (long long value)
 
std::string to_string (unsigned value)
 
std::string to_string (unsigned long value)
 
std::string to_string (unsigned long long value)
 
std::string to_string (float value)
 
std::string to_string (double value)
 
std::string to_string (long double value)
 
template<typename T , typename... Args>
std::unique_ptr< T > make_unique (Args &&...args)
 
template<typename T , typename Compare >
constexpr const T & clamp (const T &v, const T &lo, const T &hi, Compare comp)
 
template<typename T >
constexpr const T & clamp (const T &v, const T &lo, const T &hi)
 
template<typename To , typename From , enable_if_t< sizeof(To)==sizeof(From) &&is_trivially_copyable< From >::value &&is_trivially_copyable< To >::value, int > = 0>
To bit_cast (const From &src)
 Convert data between types, without aliasing issues or undefined behaviour. More...
 
template<typename T >
constexpr14 T byteswap (T n)
 
template<>
constexpr14 uint8_t byteswap (uint8_t n)
 
template<>
constexpr14 uint16_t byteswap (uint16_t n)
 
template<>
constexpr14 uint32_t byteswap (uint32_t n)
 
template<>
constexpr14 uint64_t byteswap (uint64_t n)
 
template<>
constexpr14 int8_t byteswap (int8_t n)
 
template<>
constexpr14 int16_t byteswap (int16_t n)
 
template<>
constexpr14 int32_t byteswap (int32_t n)
 
template<>
constexpr14 int64_t byteswap (int64_t n)
 

Strings

std::string size_t len
 
bool str_equals_case_insensitive (const std::string &a, const std::string &b)
 Compare strings for equality in case-insensitive manner. More...
 
bool str_startswith (const std::string &str, const std::string &start)
 Check whether a string starts with a value. More...
 
bool str_endswith (const std::string &str, const std::string &end)
 Check whether a string ends with a value. More...
 
std::string str_truncate (const std::string &str, size_t length)
 Truncate a string to a specific length. More...
 
std::string str_until (const char *str, char ch)
 Extract the part of the string until either the first occurrence of the specified character, or the end (requires str to be null-terminated). More...
 
std::string str_until (const std::string &str, char ch)
 Extract the part of the string until either the first occurrence of the specified character, or the end. More...
 
std::string str_lower_case (const std::string &str)
 Convert the string to lower case. More...
 
std::string str_upper_case (const std::string &str)
 Convert the string to upper case. More...
 
std::string str_snake_case (const std::string &str)
 Convert the string to snake case (lowercase with underscores). More...
 
std::string str_sanitize (const std::string &str)
 Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores. More...
 
std::string to_string (const std::string &val)
 Convert the value to a string (added as extra overload so that to_string() can be used on all stringifiable types). More...
 
std::string __attribute__ ((format(printf, 1, 3))) str_snprintf(const char *fmt
 snprintf-like function returning std::string of maximum length len (excluding null terminator). More...
 
std::string size_t std::string __attribute__ ((format(printf, 1, 2))) str_sprintf(const char *fmt
 sprintf-like function returning std::string. More...
 

Parsing & formatting

enum  ParseOnOffState { PARSE_NONE = 0, PARSE_ON, PARSE_OFF, PARSE_TOGGLE }
 Return values for parse_on_off(). More...
 
size_t parse_hex (const char *str, size_t len, uint8_t *data, size_t count)
 Parse bytes from a hex-encoded string into a byte array. More...
 
std::string format_hex (const uint8_t *data, size_t length)
 Format the byte array data of length len in lowercased hex. More...
 
std::string format_hex (const std::vector< uint8_t > &data)
 Format the vector data in lowercased hex. More...
 
std::string format_hex_pretty (const uint8_t *data, size_t length)
 Format the byte array data of length len in pretty-printed, human-readable hex. More...
 
std::string format_hex_pretty (const std::vector< uint8_t > &data)
 Format the vector data in pretty-printed, human-readable hex. More...
 
std::string format_hex_pretty (const uint16_t *data, size_t length)
 Format the word array data of length len in pretty-printed, human-readable hex. More...
 
std::string format_hex_pretty (const std::vector< uint16_t > &data)
 Format the vector data in pretty-printed, human-readable hex. More...
 
ParseOnOffState parse_on_off (const char *str, const char *on=nullptr, const char *off=nullptr)
 Parse a string that contains either on, off or toggle. More...
 
std::string value_accuracy_to_string (float value, int8_t accuracy_decimals)
 Create a string from a value and an accuracy in decimals. More...
 
int8_t step_to_accuracy_decimals (float step)
 Derive accuracy in decimals from an increment step. More...
 
template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0>
optional< T > parse_number (const char *str)
 Parse an unsigned decimal number from a null-terminated string. More...
 
template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0>
optional< T > parse_number (const std::string &str)
 Parse an unsigned decimal number. More...
 
bool parse_hex (const char *str, uint8_t *data, size_t count)
 Parse count bytes from the hex-encoded string str of at least 2*count characters into array data. More...
 
bool parse_hex (const std::string &str, uint8_t *data, size_t count)
 Parse count bytes from the hex-encoded string str of at least 2*count characters into array data. More...
 
bool parse_hex (const char *str, std::vector< uint8_t > &data, size_t count)
 Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data. More...
 
bool parse_hex (const std::string &str, std::vector< uint8_t > &data, size_t count)
 Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional< T > parse_hex (const char *str, size_t len)
 Parse a hex-encoded string into an unsigned integer. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional< T > parse_hex (const char *str)
 Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional< T > parse_hex (const std::string &str)
 Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
std::string format_hex (T val)
 Format an unsigned integer in lowercased hex, starting with the most significant byte. More...
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
std::string format_hex_pretty (T val)
 Format an unsigned integer in pretty-printed, human-readable hex, starting with the most significant byte. More...
 

Typedef Documentation

◆ enable_if_t

template<bool B, class T = void>
using esphome::enable_if_t = typedef typename std::enable_if<B, T>::type

Definition at line 77 of file helpers.h.

◆ int16_be_t

Definition at line 51 of file datatypes.h.

◆ int16_le_t

Definition at line 59 of file datatypes.h.

◆ int24_be_t

Definition at line 50 of file datatypes.h.

◆ int24_le_t

Definition at line 58 of file datatypes.h.

◆ int32_be_t

Definition at line 49 of file datatypes.h.

◆ int32_le_t

Definition at line 57 of file datatypes.h.

◆ int64_be_t

Definition at line 48 of file datatypes.h.

◆ int64_le_t

Definition at line 56 of file datatypes.h.

◆ uint16_be_t

Definition at line 47 of file datatypes.h.

◆ uint16_le_t

Definition at line 55 of file datatypes.h.

◆ uint24_be_t

Definition at line 46 of file datatypes.h.

◆ uint24_le_t

Definition at line 54 of file datatypes.h.

◆ uint32_be_t

Definition at line 45 of file datatypes.h.

◆ uint32_le_t

Definition at line 53 of file datatypes.h.

◆ uint64_be_t

Definition at line 44 of file datatypes.h.

◆ uint64_le_t

Definition at line 52 of file datatypes.h.

Enumeration Type Documentation

◆ EntityCategory

enum esphome::EntityCategory : uint8_t
Enumerator
ENTITY_CATEGORY_NONE 
ENTITY_CATEGORY_CONFIG 
ENTITY_CATEGORY_DIAGNOSTIC 

Definition at line 8 of file entity_base.h.

◆ ParseOnOffState

Return values for parse_on_off().

Enumerator
PARSE_NONE 
PARSE_ON 
PARSE_OFF 
PARSE_TOGGLE 

Definition at line 409 of file helpers.h.

◆ RetryResult

enum esphome::RetryResult
strong
Enumerator
DONE 
RETRY 

Definition at line 64 of file component.h.

Function Documentation

◆ __attribute__() [1/4]

void esphome::__attribute__ ( (noreturn)  )

◆ __attribute__() [2/4]

struct esphome::uint24_t esphome::__attribute__ ( (packed)  )

◆ __attribute__() [3/4]

std::string esphome::__attribute__ ( (format(printf, 1, 3))  ) const

snprintf-like function returning std::string of maximum length len (excluding null terminator).

◆ __attribute__() [4/4]

std::string size_t std::string esphome::__attribute__ ( (format(printf, 1, 2))  ) const

sprintf-like function returning std::string.

◆ api_is_connected()

bool esphome::api_is_connected ( )

Return whether the node has at least one client connected to the native API.

Definition at line 17 of file util.cpp.

◆ app_main()

void esphome::app_main ( )

Definition at line 78 of file core.cpp.

◆ arch_feed_wdt()

void esphome::arch_feed_wdt ( )

Definition at line 54 of file core.cpp.

◆ arch_get_cpu_cycle_count()

uint32_t esphome::arch_get_cpu_cycle_count ( )

Definition at line 57 of file core.cpp.

◆ arch_get_cpu_freq_hz()

uint32_t esphome::arch_get_cpu_freq_hz ( )

Definition at line 66 of file core.cpp.

◆ arch_init()

void esphome::arch_init ( )

Definition at line 38 of file core.cpp.

◆ arch_restart()

void esphome::arch_restart ( )

Definition at line 30 of file core.cpp.

◆ bit_cast()

template<typename To , typename From , enable_if_t< sizeof(To)==sizeof(From) &&is_trivially_copyable< From >::value &&is_trivially_copyable< To >::value, int > = 0>
To esphome::bit_cast ( const From &  src)

Convert data between types, without aliasing issues or undefined behaviour.

Definition at line 113 of file helpers.h.

◆ byteswap() [1/9]

template<typename T >
constexpr14 T esphome::byteswap ( n)

Definition at line 121 of file helpers.h.

◆ byteswap() [2/9]

template<>
constexpr14 uint8_t esphome::byteswap ( uint8_t  n)

Definition at line 127 of file helpers.h.

◆ byteswap() [3/9]

template<>
constexpr14 uint16_t esphome::byteswap ( uint16_t  n)

Definition at line 128 of file helpers.h.

◆ byteswap() [4/9]

template<>
constexpr14 uint32_t esphome::byteswap ( uint32_t  n)

Definition at line 129 of file helpers.h.

◆ byteswap() [5/9]

template<>
constexpr14 uint64_t esphome::byteswap ( uint64_t  n)

Definition at line 130 of file helpers.h.

◆ byteswap() [6/9]

template<>
constexpr14 int8_t esphome::byteswap ( int8_t  n)

Definition at line 131 of file helpers.h.

◆ byteswap() [7/9]

template<>
constexpr14 int16_t esphome::byteswap ( int16_t  n)

Definition at line 132 of file helpers.h.

◆ byteswap() [8/9]

template<>
constexpr14 int32_t esphome::byteswap ( int32_t  n)

Definition at line 133 of file helpers.h.

◆ byteswap() [9/9]

template<>
constexpr14 int64_t esphome::byteswap ( int64_t  n)

Definition at line 134 of file helpers.h.

◆ celsius_to_fahrenheit()

constexpr float esphome::celsius_to_fahrenheit ( float  value)

Convert degrees Celsius to degrees Fahrenheit.

Definition at line 445 of file helpers.h.

◆ clamp() [1/2]

template<typename T , typename Compare >
constexpr const T& esphome::clamp ( const T &  v,
const T &  lo,
const T &  hi,
Compare  comp 
)

Definition at line 84 of file helpers.h.

◆ clamp() [2/2]

template<typename T >
constexpr const T& esphome::clamp ( const T &  v,
const T &  lo,
const T &  hi 
)

Definition at line 87 of file helpers.h.

◆ convert_big_endian()

template<typename T >
constexpr14 T esphome::convert_big_endian ( val)

Convert a value between host byte order and big endian (most significant byte first) order.

Definition at line 228 of file helpers.h.

◆ convert_little_endian()

template<typename T >
constexpr14 T esphome::convert_little_endian ( val)

Convert a value between host byte order and little endian (least significant byte first) order.

Definition at line 237 of file helpers.h.

◆ crc16()

uint16_t esphome::crc16 ( const uint8_t *  data,
uint8_t  len 
)

Calculate a CRC-16 checksum of data with size len.

Definition at line 65 of file helpers.cpp.

◆ crc8()

uint8_t esphome::crc8 ( uint8_t *  data,
uint8_t  len 
)

Calculate a CRC-8 checksum of data with size len.

Definition at line 50 of file helpers.cpp.

◆ decode_value()

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 std::array<uint8_t, sizeof(T)> esphome::decode_value ( val)

Decode a value into its constituent bytes (from most to least significant).

Definition at line 201 of file helpers.h.

◆ delay()

void esphome::delay ( uint32_t  ms)

Definition at line 27 of file core.cpp.

◆ delay_microseconds_safe()

void esphome::delay_microseconds_safe ( uint32_t  us)

Delay for the given amount of microseconds, possibly yielding to other processes during the wait.

Definition at line 428 of file helpers.cpp.

◆ delayMicroseconds()

void esphome::delayMicroseconds ( uint32_t  us)

Definition at line 29 of file core.cpp.

◆ encode_uint16()

constexpr uint16_t esphome::encode_uint16 ( uint8_t  msb,
uint8_t  lsb 
)

Encode a 16-bit value given the most and least significant byte.

Definition at line 171 of file helpers.h.

◆ encode_uint24()

constexpr uint32_t esphome::encode_uint24 ( uint8_t  byte1,
uint8_t  byte2,
uint8_t  byte3 
)

Encode a 24-bit value given three bytes in most to least significant byte order.

Definition at line 180 of file helpers.h.

◆ encode_uint32()

constexpr uint32_t esphome::encode_uint32 ( uint8_t  byte1,
uint8_t  byte2,
uint8_t  byte3,
uint8_t  byte4 
)

Encode a 32-bit value given four bytes in most to least significant byte order.

Definition at line 175 of file helpers.h.

◆ encode_value() [1/2]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 T esphome::encode_value ( const uint8_t *  bytes)

Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T).

Definition at line 186 of file helpers.h.

◆ encode_value() [2/2]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
constexpr14 T esphome::encode_value ( const std::array< uint8_t, sizeof(T)>  bytes)

Encode a value from its constituent bytes (from most to least significant) in an std::array with length sizeof(T).

Definition at line 196 of file helpers.h.

◆ esp_idf_log_vprintf_()

int esphome::esp_idf_log_vprintf_ ( const char *  format,
va_list  args 
)

Definition at line 50 of file log.cpp.

◆ esp_log_printf_() [1/2]

void esphome::esp_log_printf_ ( int  level,
const char *  tag,
int  line,
const char *  format,
  ... 
)

Definition at line 11 of file log.cpp.

◆ esp_log_printf_() [2/2]

void void esphome::esp_log_printf_ ( int  level,
const char *  tag,
int  line,
const __FlashStringHelper *  format,
  ... 
)

Definition at line 18 of file log.cpp.

◆ esp_log_vprintf_() [1/2]

void esphome::esp_log_vprintf_ ( int  level,
const char *  tag,
int  line,
const char *  format,
va_list  args 
)

Definition at line 26 of file log.cpp.

◆ esp_log_vprintf_() [2/2]

void esphome::esp_log_vprintf_ ( int  level,
const char *  tag,
int  line,
const __FlashStringHelper *  format,
va_list  args 
)

Definition at line 37 of file log.cpp.

◆ ESPDEPRECATED() [1/3]

esphome::ESPDEPRECATED ( "Use Color::BLACK instead of COLOR_BLACK ,
"v1.21"   
) const

◆ ESPDEPRECATED() [2/3]

esphome::ESPDEPRECATED ( "Use Color::WHITE instead of COLOR_WHITE ,
"v1.21"   
) const

◆ ESPDEPRECATED() [3/3]

esphome::ESPDEPRECATED ( "hexencode() is  deprecated,
use format_hex_pretty() instead."  ,
"2022.1"   
)

Definition at line 653 of file helpers.h.

◆ fahrenheit_to_celsius()

constexpr float esphome::fahrenheit_to_celsius ( float  value)

Convert degrees Fahrenheit to degrees Celsius.

Definition at line 447 of file helpers.h.

◆ fnv1_hash()

uint32_t esphome::fnv1_hash ( const std::string &  str)

Calculate a FNV-1 hash of str.

Definition at line 80 of file helpers.cpp.

◆ force_link_symbols()

void esphome::force_link_symbols ( )

Definition at line 38 of file core.cpp.

◆ format_hex() [1/3]

std::string esphome::format_hex ( const uint8_t *  data,
size_t  length 
)

Format the byte array data of length len in lowercased hex.

Definition at line 202 of file helpers.cpp.

◆ format_hex() [2/3]

std::string esphome::format_hex ( const std::vector< uint8_t > &  data)

Format the vector data in lowercased hex.

Definition at line 211 of file helpers.cpp.

◆ format_hex() [3/3]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
std::string esphome::format_hex ( val)

Format an unsigned integer in lowercased hex, starting with the most significant byte.

Definition at line 389 of file helpers.h.

◆ format_hex_pretty() [1/5]

std::string esphome::format_hex_pretty ( const uint8_t *  data,
size_t  length 
)

Format the byte array data of length len in pretty-printed, human-readable hex.

Definition at line 214 of file helpers.cpp.

◆ format_hex_pretty() [2/5]

std::string esphome::format_hex_pretty ( const std::vector< uint8_t > &  data)

Format the vector data in pretty-printed, human-readable hex.

Definition at line 229 of file helpers.cpp.

◆ format_hex_pretty() [3/5]

std::string esphome::format_hex_pretty ( const uint16_t *  data,
size_t  length 
)

Format the word array data of length len in pretty-printed, human-readable hex.

Definition at line 231 of file helpers.cpp.

◆ format_hex_pretty() [4/5]

std::string esphome::format_hex_pretty ( const std::vector< uint16_t > &  data)

Format the vector data in pretty-printed, human-readable hex.

Definition at line 248 of file helpers.cpp.

◆ format_hex_pretty() [5/5]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
std::string esphome::format_hex_pretty ( val)

Format an unsigned integer in pretty-printed, human-readable hex, starting with the most significant byte.

Definition at line 403 of file helpers.h.

◆ gamma_correct()

float esphome::gamma_correct ( float  value,
float  gamma 
)

Applies gamma correction of gamma to value.

Definition at line 291 of file helpers.cpp.

◆ gamma_uncorrect()

float esphome::gamma_uncorrect ( float  value,
float  gamma 
)

Reverts gamma correction of gamma to value.

Definition at line 299 of file helpers.cpp.

◆ get_mac_address()

std::string esphome::get_mac_address ( )

Get the device MAC address as a string, in lowercase hex notation.

Definition at line 414 of file helpers.cpp.

◆ get_mac_address_pretty()

std::string esphome::get_mac_address_pretty ( )

Get the device MAC address as a string, in colon-separated uppercase hex notation.

Definition at line 419 of file helpers.cpp.

◆ get_mac_address_raw()

void esphome::get_mac_address_raw ( uint8_t *  mac)

Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).

Definition at line 399 of file helpers.cpp.

◆ hsv_to_rgb()

void esphome::hsv_to_rgb ( int  hue,
float  saturation,
float  value,
float &  red,
float &  green,
float &  blue 
)

Convert hue (0-360), saturation (0-1) and value (0-1) to red, green and blue (all 0-1).

Definition at line 331 of file helpers.cpp.

◆ id() [1/2]

template<typename T , enable_if_t<!std::is_pointer< T >::value, int > = 0>
T esphome::id ( value)

Helper function to make id(var) known from lambdas work in custom components.

This function is not called from lambdas, the code generator replaces calls to it with the appropriate variable.

Definition at line 641 of file helpers.h.

◆ id() [2/2]

template<typename T , enable_if_t< std::is_pointer< T *>::value, int > = 0>
T& esphome::id ( T *  value)

Helper function to make id(var) known from lambdas work in custom components.

This function is not called from lambdas, the code generator replaces calls to it with the appropriate variable.

Definition at line 646 of file helpers.h.

◆ init()

void esphome::init ( )

Definition at line 85 of file core.cpp.

◆ lerp()

float esphome::lerp ( float  completion,
float  start,
float  end 
)

Linearly interpolate between start and end by completion (between 0 and 1).

Definition at line 49 of file helpers.cpp.

◆ loop_task()

void esphome::loop_task ( void *  pv_params)

Definition at line 71 of file core.cpp.

◆ make_optional()

template<typename T >
optional<T> esphome::make_optional ( T const &  v)
inline

Definition at line 214 of file optional.h.

◆ make_unique()

template<typename T , typename... Args>
std::unique_ptr<T> esphome::make_unique ( Args &&...  args)

Definition at line 68 of file helpers.h.

◆ micros()

uint32_t esphome::micros ( )

Definition at line 28 of file core.cpp.

◆ millis()

uint32_t esphome::millis ( )

Definition at line 26 of file core.cpp.

◆ mqtt_is_connected()

bool esphome::mqtt_is_connected ( )

Return whether the node has an active connection to an MQTT broker.

Definition at line 26 of file util.cpp.

◆ nullopt()

const nullopt_t esphome::nullopt ( (nullopt_t::init())  )

◆ operator!=() [1/5]

template<typename T , typename U >
bool esphome::operator!= ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 118 of file optional.h.

◆ operator!=() [2/5]

template<typename T >
bool esphome::operator!= ( optional< T > const &  x,
nullopt_t   
)
inline

Definition at line 138 of file optional.h.

◆ operator!=() [3/5]

template<typename T >
bool esphome::operator!= ( nullopt_t  ,
optional< T > const &  x 
)
inline

Definition at line 140 of file optional.h.

◆ operator!=() [4/5]

template<typename T , typename U >
bool esphome::operator!= ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 168 of file optional.h.

◆ operator!=() [5/5]

template<typename T , typename U >
bool esphome::operator!= ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 172 of file optional.h.

◆ operator<() [1/5]

template<typename T , typename U >
bool esphome::operator< ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 122 of file optional.h.

◆ operator<() [2/5]

template<typename T >
bool esphome::operator< ( optional< T > const &  ,
nullopt_t   
)
inline

Definition at line 142 of file optional.h.

◆ operator<() [3/5]

template<typename T >
bool esphome::operator< ( nullopt_t  ,
optional< T > const &  x 
)
inline

Definition at line 144 of file optional.h.

◆ operator<() [4/5]

template<typename T , typename U >
bool esphome::operator< ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 176 of file optional.h.

◆ operator<() [5/5]

template<typename T , typename U >
bool esphome::operator< ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 180 of file optional.h.

◆ operator<=() [1/5]

template<typename T , typename U >
bool esphome::operator<= ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 128 of file optional.h.

◆ operator<=() [2/5]

template<typename T >
bool esphome::operator<= ( optional< T > const &  x,
nullopt_t   
)
inline

Definition at line 146 of file optional.h.

◆ operator<=() [3/5]

template<typename T >
bool esphome::operator<= ( nullopt_t  ,
optional< T > const &   
)
inline

Definition at line 148 of file optional.h.

◆ operator<=() [4/5]

template<typename T , typename U >
bool esphome::operator<= ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 184 of file optional.h.

◆ operator<=() [5/5]

template<typename T , typename U >
bool esphome::operator<= ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 188 of file optional.h.

◆ operator==() [1/5]

template<typename T , typename U >
bool esphome::operator== ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 114 of file optional.h.

◆ operator==() [2/5]

template<typename T >
bool esphome::operator== ( optional< T > const &  x,
nullopt_t   
)
inline

Definition at line 134 of file optional.h.

◆ operator==() [3/5]

template<typename T >
bool esphome::operator== ( nullopt_t  ,
optional< T > const &  x 
)
inline

Definition at line 136 of file optional.h.

◆ operator==() [4/5]

template<typename T , typename U >
bool esphome::operator== ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 160 of file optional.h.

◆ operator==() [5/5]

template<typename T , typename U >
bool esphome::operator== ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 164 of file optional.h.

◆ operator>() [1/5]

template<typename T , typename U >
bool esphome::operator> ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 126 of file optional.h.

◆ operator>() [2/5]

template<typename T >
bool esphome::operator> ( optional< T > const &  x,
nullopt_t   
)
inline

Definition at line 150 of file optional.h.

◆ operator>() [3/5]

template<typename T >
bool esphome::operator> ( nullopt_t  ,
optional< T > const &   
)
inline

Definition at line 152 of file optional.h.

◆ operator>() [4/5]

template<typename T , typename U >
bool esphome::operator> ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 192 of file optional.h.

◆ operator>() [5/5]

template<typename T , typename U >
bool esphome::operator> ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 196 of file optional.h.

◆ operator>=() [1/5]

template<typename T , typename U >
bool esphome::operator>= ( optional< T > const &  x,
optional< U > const &  y 
)
inline

Definition at line 130 of file optional.h.

◆ operator>=() [2/5]

template<typename T >
bool esphome::operator>= ( optional< T > const &  ,
nullopt_t   
)
inline

Definition at line 154 of file optional.h.

◆ operator>=() [3/5]

template<typename T >
bool esphome::operator>= ( nullopt_t  ,
optional< T > const &  x 
)
inline

Definition at line 156 of file optional.h.

◆ operator>=() [4/5]

template<typename T , typename U >
bool esphome::operator>= ( optional< T > const &  x,
U const &  v 
)
inline

Definition at line 200 of file optional.h.

◆ operator>=() [5/5]

template<typename T , typename U >
bool esphome::operator>= ( U const &  v,
optional< T > const &  x 
)
inline

Definition at line 204 of file optional.h.

◆ parse_hex() [1/8]

size_t esphome::parse_hex ( const char *  str,
size_t  len,
uint8_t *  data,
size_t  count 
)

Parse bytes from a hex-encoded string into a byte array.

When len is less than 2*count, the result is written to the back of data (i.e. this function treats str as if it were padded with zeros at the front).

Parameters
strString to read from.
lenLength of str (excluding optional null-terminator), is a limit on the number of characters parsed.
dataByte array to write to.
countLength of data.
Returns
The number of characters parsed from str.

Definition at line 183 of file helpers.cpp.

◆ parse_hex() [2/8]

bool esphome::parse_hex ( const char *  str,
uint8_t *  data,
size_t  count 
)
inline

Parse count bytes from the hex-encoded string str of at least 2*count characters into array data.

Definition at line 346 of file helpers.h.

◆ parse_hex() [3/8]

bool esphome::parse_hex ( const std::string &  str,
uint8_t *  data,
size_t  count 
)
inline

Parse count bytes from the hex-encoded string str of at least 2*count characters into array data.

Definition at line 350 of file helpers.h.

◆ parse_hex() [4/8]

bool esphome::parse_hex ( const char *  str,
std::vector< uint8_t > &  data,
size_t  count 
)
inline

Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data.

Definition at line 354 of file helpers.h.

◆ parse_hex() [5/8]

bool esphome::parse_hex ( const std::string &  str,
std::vector< uint8_t > &  data,
size_t  count 
)
inline

Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data.

Definition at line 359 of file helpers.h.

◆ parse_hex() [6/8]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional<T> esphome::parse_hex ( const char *  str,
size_t  len 
)

Parse a hex-encoded string into an unsigned integer.

Parameters
strString to read from, starting with the most significant byte.
lenLength of str (excluding optional null-terminator), is a limit on the number of characters parsed.

Definition at line 369 of file helpers.h.

◆ parse_hex() [7/8]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional<T> esphome::parse_hex ( const char *  str)

Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer.

Definition at line 376 of file helpers.h.

◆ parse_hex() [8/8]

template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
optional<T> esphome::parse_hex ( const std::string &  str)

Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer.

Definition at line 380 of file helpers.h.

◆ parse_number() [1/2]

template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0>
optional< T > esphome::parse_number ( const char *  str)

Parse an unsigned decimal number from a null-terminated string.

Parse a decimal floating-point number from a null-terminated string.

Parse a signed decimal number from a null-terminated string.

Definition at line 293 of file helpers.h.

◆ parse_number() [2/2]

template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0>
optional< T > esphome::parse_number ( const std::string &  str)

Parse an unsigned decimal number.

Parse a decimal floating-point number.

Parse a signed decimal number.

Definition at line 302 of file helpers.h.

◆ parse_on_off()

ParseOnOffState esphome::parse_on_off ( const char *  str,
const char *  on,
const char *  off 
)

Parse a string that contains either on, off or toggle.

Definition at line 250 of file helpers.cpp.

◆ progmem_read_byte()

uint8_t esphome::progmem_read_byte ( const uint8_t *  addr)

Definition at line 56 of file core.cpp.

◆ random_bytes()

bool esphome::random_bytes ( uint8_t *  data,
size_t  len 
)

Generate len number of random bytes.

Definition at line 99 of file helpers.cpp.

◆ random_float()

float esphome::random_float ( )

Return a random float between 0 and 1.

Definition at line 98 of file helpers.cpp.

◆ random_uint32()

uint32_t esphome::random_uint32 ( )

Return a random 32-bit unsigned integer.

Definition at line 89 of file helpers.cpp.

◆ remap()

template<typename T , typename U >
T esphome::remap ( value,
min,
max,
min_out,
max_out 
)

Remap value from the range (min, max) to (min_out, max_out).

Definition at line 145 of file helpers.h.

◆ remote_is_connected()

bool esphome::remote_is_connected ( )

Return whether the node has any form of "remote" connection via the API or to an MQTT broker.

Definition at line 35 of file util.cpp.

◆ resetPins()

void esphome::resetPins ( )

Definition at line 52 of file core.cpp.

◆ reverse_bits() [1/3]

uint8_t esphome::reverse_bits ( uint8_t  x)
inline

Reverse the order of 8 bits.

Definition at line 211 of file helpers.h.

◆ reverse_bits() [2/3]

uint16_t esphome::reverse_bits ( uint16_t  x)
inline

Reverse the order of 16 bits.

Definition at line 218 of file helpers.h.

◆ reverse_bits() [3/3]

uint32_t esphome::reverse_bits ( uint32_t  x)
inline

Reverse the order of 32 bits.

Definition at line 222 of file helpers.h.

◆ rgb_to_hsv()

void esphome::rgb_to_hsv ( float  red,
float  green,
float  blue,
int &  hue,
float &  saturation,
float &  value 
)

Convert red, green and blue (all 0-1) values to hue (0-360), saturation (0-1) and value (0-1).

Definition at line 308 of file helpers.cpp.

◆ set_mac_address()

void esphome::set_mac_address ( uint8_t *  mac)

Set the MAC address to use from the provided byte array (6 bytes).

Definition at line 425 of file helpers.cpp.

◆ step_to_accuracy_decimals()

int8_t esphome::step_to_accuracy_decimals ( float  step)

Derive accuracy in decimals from an increment step.

Definition at line 276 of file helpers.cpp.

◆ str_ctype_transform()

template<int(*)(int) fn>
std::string esphome::str_ctype_transform ( const std::string &  str)

Definition at line 129 of file helpers.cpp.

◆ str_endswith()

bool esphome::str_endswith ( const std::string &  str,
const std::string &  end 
)

Check whether a string ends with a value.

Definition at line 116 of file helpers.cpp.

◆ str_equals_case_insensitive()

bool esphome::str_equals_case_insensitive ( const std::string &  a,
const std::string &  b 
)

Compare strings for equality in case-insensitive manner.

Definition at line 112 of file helpers.cpp.

◆ str_lower_case()

std::string esphome::str_lower_case ( const std::string &  str)

Convert the string to lower case.

Definition at line 135 of file helpers.cpp.

◆ str_sanitize()

std::string esphome::str_sanitize ( const std::string &  str)

Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores.

Definition at line 144 of file helpers.cpp.

◆ str_snake_case()

std::string esphome::str_snake_case ( const std::string &  str)

Convert the string to snake case (lowercase with underscores).

Definition at line 137 of file helpers.cpp.

◆ str_snprintf()

std::string esphome::str_snprintf ( const char *  fmt,
size_t  len,
  ... 
)

Definition at line 151 of file helpers.cpp.

◆ str_sprintf()

std::string esphome::str_sprintf ( const char *  fmt,
  ... 
)

Definition at line 165 of file helpers.cpp.

◆ str_startswith()

bool esphome::str_startswith ( const std::string &  str,
const std::string &  start 
)

Check whether a string starts with a value.

Definition at line 115 of file helpers.cpp.

◆ str_truncate()

std::string esphome::str_truncate ( const std::string &  str,
size_t  length 
)

Truncate a string to a specific length.

Definition at line 119 of file helpers.cpp.

◆ str_until() [1/2]

std::string esphome::str_until ( const char *  str,
char  ch 
)

Extract the part of the string until either the first occurrence of the specified character, or the end (requires str to be null-terminated).

Definition at line 122 of file helpers.cpp.

◆ str_until() [2/2]

std::string esphome::str_until ( const std::string &  str,
char  ch 
)

Extract the part of the string until either the first occurrence of the specified character, or the end.

Definition at line 126 of file helpers.cpp.

◆ str_upper_case()

std::string esphome::str_upper_case ( const std::string &  str)

Convert the string to upper case.

Definition at line 136 of file helpers.cpp.

◆ swap()

template<typename T >
void esphome::swap ( optional< T > &  x,
optional< T > &  y 
)

Definition at line 210 of file optional.h.

◆ to_string() [1/10]

std::string esphome::to_string ( int  value)

Definition at line 36 of file helpers.cpp.

◆ to_string() [2/10]

std::string esphome::to_string ( long  value)

Definition at line 37 of file helpers.cpp.

◆ to_string() [3/10]

std::string esphome::to_string ( long long  value)

Definition at line 38 of file helpers.cpp.

◆ to_string() [4/10]

std::string esphome::to_string ( unsigned  value)

Definition at line 39 of file helpers.cpp.

◆ to_string() [5/10]

std::string esphome::to_string ( unsigned long  value)

Definition at line 40 of file helpers.cpp.

◆ to_string() [6/10]

std::string esphome::to_string ( unsigned long long  value)

Definition at line 41 of file helpers.cpp.

◆ to_string() [7/10]

std::string esphome::to_string ( float  value)

Definition at line 42 of file helpers.cpp.

◆ to_string() [8/10]

std::string esphome::to_string ( double  value)

Definition at line 43 of file helpers.cpp.

◆ to_string() [9/10]

std::string esphome::to_string ( long double  value)

Definition at line 44 of file helpers.cpp.

◆ to_string() [10/10]

std::string esphome::to_string ( const std::string &  val)
inline

Convert the value to a string (added as extra overload so that to_string() can be used on all stringifiable types).

Definition at line 259 of file helpers.h.

◆ value_accuracy_to_string()

std::string esphome::value_accuracy_to_string ( float  value,
int8_t  accuracy_decimals 
)

Create a string from a value and an accuracy in decimals.

Definition at line 265 of file helpers.cpp.

◆ yield()

void esphome::yield ( )

Definition at line 25 of file core.cpp.

Variable Documentation

◆ __attribute__

struct esphome::int24_t esphome::__attribute__

◆ App

Application esphome::App

Global storage of Application pointer - only one Application can exist.

Definition at line 155 of file application.cpp.

◆ COLOR_BLACK

const Color esphome::COLOR_BLACK(0, 0, 0, 0)

◆ COLOR_WHITE

const Color esphome::COLOR_WHITE(255, 255, 255, 255)

◆ COMPONENT_STATE_CONSTRUCTION

const uint32_t esphome::COMPONENT_STATE_CONSTRUCTION = 0x00

Definition at line 31 of file component.cpp.

◆ COMPONENT_STATE_FAILED

const uint32_t esphome::COMPONENT_STATE_FAILED = 0x03

Definition at line 34 of file component.cpp.

◆ COMPONENT_STATE_LOOP

const uint32_t esphome::COMPONENT_STATE_LOOP = 0x02

Definition at line 33 of file component.cpp.

◆ COMPONENT_STATE_MASK

const uint32_t esphome::COMPONENT_STATE_MASK = 0xFF

Definition at line 30 of file component.cpp.

◆ COMPONENT_STATE_SETUP

const uint32_t esphome::COMPONENT_STATE_SETUP = 0x01

Definition at line 32 of file component.cpp.

◆ global_preferences

ESPPreferences * esphome::global_preferences

Definition at line 194 of file preferences.cpp.

◆ global_state

uint32_t esphome::global_state = 0

Definition at line 40 of file component.cpp.

◆ len

std::string size_t esphome::len

Definition at line 281 of file helpers.h.

◆ loop_task_handle

TaskHandle_t esphome::loop_task_handle = nullptr

Definition at line 69 of file core.cpp.

◆ STATUS_LED_ERROR

const uint32_t esphome::STATUS_LED_ERROR = 0x0200

Definition at line 38 of file component.cpp.

◆ STATUS_LED_MASK

const uint32_t esphome::STATUS_LED_MASK = 0xFF00

Definition at line 35 of file component.cpp.

◆ STATUS_LED_OK

const uint32_t esphome::STATUS_LED_OK = 0x0000

Definition at line 36 of file component.cpp.

◆ STATUS_LED_WARNING

const uint32_t esphome::STATUS_LED_WARNING = 0x0100

Definition at line 37 of file component.cpp.