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

This is a workaround until we can figure out a way to get the tflite-micro idf component code available in CI. More...

Namespaces

 a01nyub
 
 a02yyuw
 
 a4988
 
 absolute_humidity
 
 ac_dimmer
 
 adalight
 
 adc
 
 adc128s102
 
 addressable_light
 
 ade7953_base
 
 ade7953_i2c
 
 ade7953_spi
 
 ads1115
 
 aht10
 
 airthings_ble
 
 airthings_wave_base
 
 airthings_wave_mini
 
 airthings_wave_plus
 
 alarm_control_panel
 
 alpha3
 
 am2320
 
 am43
 
 analog_threshold
 
 animation
 
 anova
 
 apds9960
 
 api
 
 as3935
 
 as3935_i2c
 
 as3935_spi
 
 as5600
 
 as7341
 
 atc_mithermometer
 
 atm90e26
 
 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_base
 
 bme280_i2c
 
 bme280_spi
 
 bme680
 
 bme680_bsec
 
 bmi160
 
 bmp085
 
 bmp280
 
 bmp3xx
 
 bmp581
 
 bp1658cj
 
 bp5758d
 
 button
 
 canbus
 
 cap1188
 
 captive_portal
 
 ccs811
 
 cd74hc4067
 
 climate
 
 climate_ir
 
 climate_ir_lg
 
 color_temperature
 
 combination
 
 coolix
 
 copy
 
 cover
 
 cs5460a
 
 cse7761
 
 cse7766
 
 ct_clamp
 
 current_based
 
 custom
 
 custom_component
 
 cwww
 
 dac7678
 
 daikin
 
 daikin_brc
 
 dallas
 
 daly_bms
 
 dashboard_import
 
 debug
 
 deep_sleep
 
 delonghi
 
 demo
 
 dfplayer
 
 dfrobot_sen0395
 
 dht
 
 dht12
 
 display
 
 display_menu_base
 
 dps310
 
 ds1307
 
 dsmr
 
 duty_cycle
 
 duty_time_sensor
 
 e131
 
 ee895
 
 ektf2232
 
 emc2101
 
 endstop
 
 ens160
 
 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_rmt_led_strip
 
 esp32_touch
 
 esp8266
 
 esp8266_pwm
 
 ethernet
 
 ethernet_info
 
 exposure_notifications
 
 ezo
 
 ezo_pmp
 
 factory_reset
 
 fan
 
 fastled_base
 
 feedback
 
 fingerprint_grow
 
 font
 
 fs3000
 
 ft5x06
 
 ft63x6
 
 fujitsu_general
 
 gcja5
 
 globals
 
 gp8403
 
 gpio
 
 gps
 
 graph
 
 graphical_display_menu
 
 gree
 
 grove_tb6612fng
 
 growatt_solar
 
 gt911
 
 haier
 
 havells_solar
 
 hbridge
 
 hdc1080
 
 he60r
 
 heatpumpir
 
 hitachi_ac344
 
 hitachi_ac424
 
 hlw8012
 
 hm3301
 
 hmc5883l
 
 homeassistant
 
 honeywell_hih_i2c
 
 honeywellabp
 
 honeywellabp2_i2c
 
 host
 
 hrxl_maxsonar_wr
 
 hte501
 
 http_request
 
 htu21d
 
 hx711
 
 hydreon_rgxx
 
 hyt271
 
 i2c
 
 i2s_audio
 
 iaqcore
 
 ili9xxx
 
 image
 
 improv_base
 
 improv_serial
 
 ina219
 
 ina226
 
 ina260
 
 ina3221
 
 inkbird_ibsth1_mini
 
 inkplate6
 
 integration
 
 internal
 
 internal_temperature
 
 interval
 
 json
 
 key_collector
 
 key_provider
 
 kmeteriso
 
 kuntze
 
 lcd_base
 
 lcd_gpio
 
 lcd_menu
 
 lcd_pcf8574
 
 ld2410
 
 ld2420
 
 ledc
 
 libretiny
 
 libretiny_pwm
 
 light
 
 lightwaverf
 
 lilygo_t5_47
 
 lock
 
 logger
 
 ltr390
 
 matrix_keypad
 
 max31855
 
 max31856
 
 max31865
 
 max44009
 
 max6675
 
 max6956
 
 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
 
 micro_wake_word
 
 micronova
 
 microphone
 
 mics_4514
 
 midea
 
 midea_ir
 
 mitsubishi
 
 mlx90393
 
 mlx90614
 
 mmc5603
 
 mmc5983
 
 modbus
 
 modbus_controller
 
 monochromatic
 
 mopeka_ble
 
 mopeka_pro_check
 
 mopeka_std_check
 
 mpl3115a2
 
 mpr121
 
 mpu6050
 
 mpu6886
 
 mqtt
 
 
 ms5611
 
 my9231
 
 neopixelbus
 
 network
 
 nextion
 
 nfc
 
 noblex
 
 ntc
 
 number
 
 ota
 
 output
 
 partition
 
 pca6416a
 
 pca9554
 
 pca9685
 
 pcd8544
 
 pcf85063
 
 pcf8563
 
 pcf8574
 
 pid
 
 pipsolar
 
 pm1006
 
 pmsa003i
 
 pmsx003
 
 pmwcs3
 
 pn532
 
 pn532_i2c
 
 pn532_spi
 
 pn7150
 
 pn7150_i2c
 
 pn7160
 
 pn7160_i2c
 
 pn7160_spi
 
 power_supply
 
 preferences
 
 prometheus
 
 psram
 
 pulse_counter
 
 pulse_meter
 
 pulse_width
 
 pvvx_mithermometer
 
 pylontech
 
 pzem004t
 
 pzemac
 
 pzemdc
 
 qmc5883l
 
 qmp6988
 
 qr_code
 
 qwiic_pir
 
 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
 
 resistance_sampler
 
 restart
 
 rf_bridge
 
 rgb
 
 rgbct
 
 rgbw
 
 rgbww
 
 rotary_encoder
 
 rp2040
 
 rp2040_pio_led_strip
 
 rp2040_pwm
 
 rtttl
 
 ruuvi_ble
 
 ruuvitag
 
 safe_mode
 
 scd30
 
 scd4x
 
 script
 
 sdm_meter
 
 sdp3x
 
 sds011
 
 selec_meter
 
 select
 
 sen0321_sensor
 
 sen21231_sensor
 
 sen5x
 
 senseair
 
 sensirion_common
 
 sensor
 
 servo
 
 setup_priority
 Default setup priorities for components of different types.
 
 sfa30
 
 sgp30
 
 sgp4x
 
 shelly_dimmer
 
 sht3xd
 
 sht4x
 
 shtcx
 
 shutdown
 
 sigma_delta_output
 
 sim800l
 
 slow_pwm
 
 sm10bit_base
 
 sm16716
 
 sm2135
 
 sm2235
 
 sm2335
 
 sm300d2
 
 sml
 
 smt100
 
 sn74hc165
 
 sn74hc595
 
 sntp
 
 socket
 
 sonoff_d1
 
 speaker
 
 speed
 
 spi
 
 spi_device
 
 spi_led_strip
 
 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
 
 st7567_base
 
 st7567_i2c
 
 st7567_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
 
 tee501
 
 teleinfo
 
 template_
 
 text
 
 text_sensor
 
 thermostat
 
 time
 
 time_based
 
 tlc59208f
 
 tlc5947
 
 tm1621
 
 tm1637
 
 tm1638
 
 tm1651
 
 tmp102
 
 tmp1075
 
 tmp117
 
 tof10120
 
 toshiba
 
 total_daily_energy
 
 touchscreen
 
 tsl2561
 
 tsl2591
 
 tt21100
 
 ttp229_bsf
 
 ttp229_lsf
 
 tuya
 
 tx20
 
 uart
 
 ufire_ec
 
 ufire_ise
 
 uln2003
 
 ultrasonic
 
 uptime
 
 vbus
 
 veml3235
 
 version
 
 vl53l0x
 
 voice_assistant
 
 voltage_sampler
 
 wake_on_lan
 
 waveshare_epaper
 
 web_server
 
 web_server_base
 
 web_server_idf
 
 whirlpool
 
 whynter
 
 wiegand
 
 wifi
 
 wifi_info
 
 wifi_signal
 
 wireguard
 
 wl_134
 
 wled
 
 x9c
 
 xgzp68xx
 
 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
 
 xl9535
 
 xpt2046
 
 yashima
 
 zhlt01
 
 zio_ultrasonic
 
 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  EntityBase_DeviceClass
 
class  EntityBase_UnitOfMeasurement
 
class  ESPPreferenceBackend
 
class  ESPPreferenceObject
 
class  ESPPreferences
 
struct  ESPTime
 A more user-friendly version of struct tm from time.h. More...
 
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  LockGuard
 Helper class that wraps a mutex with a RAII-style API. More...
 
class  LoopTrigger
 
class  Mutex
 Mutex implementation, with API based on the unavailable std::mutex. More...
 
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  ResumeComponentAction
 
class  RingBuffer
 
class  Scheduler
 
struct  seq
 
class  ShutdownTrigger
 
class  StartupTrigger
 
class  StringRef
 StringRef is a reference to a string owned by something else. More...
 
class  SuspendComponentAction
 
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
 
class  XorCondition
 

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)
 
void convertToJson (const StringRef &src, JsonVariant dst)
 
bool operator== (const StringRef &lhs, const StringRef &rhs)
 
bool operator== (const StringRef &lhs, const std::string &rhs)
 
bool operator== (const std::string &lhs, const StringRef &rhs)
 
bool operator== (const StringRef &lhs, const char *rhs)
 
bool operator== (const char *lhs, const StringRef &rhs)
 
bool operator!= (const StringRef &lhs, const StringRef &rhs)
 
bool operator!= (const StringRef &lhs, const std::string &rhs)
 
bool operator!= (const std::string &lhs, const StringRef &rhs)
 
bool operator!= (const StringRef &lhs, const char *rhs)
 
bool operator!= (const char *lhs, const StringRef &rhs)
 
bool operator< (const StringRef &lhs, const StringRef &rhs)
 
std::string & operator+= (std::string &lhs, const StringRef &rhs)
 
std::string operator+ (const char *lhs, const StringRef &rhs)
 
std::string operator+ (const StringRef &lhs, const char *rhs)
 
template<typename T >
bool increment_time_value (T &current, uint16_t begin, uint16_t end)
 
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, uint16_t len, uint16_t crc=0xffff, uint16_t reverse_poly=0xa001, bool refin=false, bool refout=false)
 Calculate a CRC-16 checksum of data with size len. More...
 
uint16_t crc16be (const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout)
 
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<std::size_t N>
std::string format_hex (const std::array< uint8_t, N > &data)
 
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...
 

Detailed Description

This is a workaround until we can figure out a way to get the tflite-micro idf component code available in CI.

Implementation of SPI Controller mode.

Author: Gustavo Ambrozio Based on work by: Atsushi Sasaki (https://github.com/aselectroworks/Arduino-FT6336U)

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 85 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 9 of file entity_base.h.

◆ ParseOnOffState

Return values for parse_on_off().

Enumerator
PARSE_NONE 
PARSE_ON 
PARSE_OFF 
PARSE_TOGGLE 

Definition at line 423 of file helpers.h.

◆ RetryResult

enum esphome::RetryResult
strong
Enumerator
DONE 
RETRY 

Definition at line 66 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 73 of file core.cpp.

◆ arch_feed_wdt()

void esphome::arch_feed_wdt ( )

Definition at line 53 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 61 of file core.cpp.

◆ arch_init()

void esphome::arch_init ( )

Definition at line 37 of file core.cpp.

◆ arch_restart()

void esphome::arch_restart ( )

Definition at line 29 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 121 of file helpers.h.

◆ byteswap() [1/9]

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

Definition at line 129 of file helpers.h.

◆ byteswap() [2/9]

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

Definition at line 135 of file helpers.h.

◆ byteswap() [3/9]

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

Definition at line 136 of file helpers.h.

◆ byteswap() [4/9]

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

Definition at line 137 of file helpers.h.

◆ byteswap() [5/9]

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

Definition at line 138 of file helpers.h.

◆ byteswap() [6/9]

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

Definition at line 139 of file helpers.h.

◆ byteswap() [7/9]

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

Definition at line 140 of file helpers.h.

◆ byteswap() [8/9]

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

Definition at line 141 of file helpers.h.

◆ byteswap() [9/9]

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

Definition at line 142 of file helpers.h.

◆ celsius_to_fahrenheit()

constexpr float esphome::celsius_to_fahrenheit ( float  value)

Convert degrees Celsius to degrees Fahrenheit.

Definition at line 459 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 92 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 95 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 239 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 248 of file helpers.h.

◆ convertToJson()

void esphome::convertToJson ( const StringRef src,
JsonVariant  dst 
)

Definition at line 8 of file string_ref.cpp.

◆ crc16()

uint16_t esphome::crc16 ( const uint8_t *  data,
uint16_t  len,
uint16_t  crc,
uint16_t  reverse_poly,
bool  refin,
bool  refout 
)

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

Definition at line 110 of file helpers.cpp.

◆ crc16be()

uint16_t esphome::crc16be ( const uint8_t *  data,
uint16_t  len,
uint16_t  crc,
uint16_t  poly,
bool  refin,
bool  refout 
)

Definition at line 148 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 94 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 212 of file helpers.h.

◆ delay()

void esphome::delay ( uint32_t  ms)

Definition at line 26 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 599 of file helpers.cpp.

◆ delayMicroseconds()

void esphome::delayMicroseconds ( uint32_t  us)

Definition at line 28 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 182 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 191 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 186 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 197 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 207 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 701 of file helpers.h.

◆ fahrenheit_to_celsius()

constexpr float esphome::fahrenheit_to_celsius ( float  value)

Convert degrees Fahrenheit to degrees Celsius.

Definition at line 461 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 182 of file helpers.cpp.

◆ force_link_symbols()

void esphome::force_link_symbols ( )

Definition at line 38 of file core.cpp.

◆ format_hex() [1/4]

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 347 of file helpers.cpp.

◆ format_hex() [2/4]

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

Format the vector data in lowercased hex.

Definition at line 356 of file helpers.cpp.

◆ format_hex() [3/4]

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 400 of file helpers.h.

◆ format_hex() [4/4]

template<std::size_t N>
std::string esphome::format_hex ( const std::array< uint8_t, N > &  data)

Definition at line 404 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 359 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 374 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 376 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 393 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 417 of file helpers.h.

◆ gamma_correct()

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

Applies gamma correction of gamma to value.

Definition at line 436 of file helpers.cpp.

◆ gamma_uncorrect()

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

Reverts gamma correction of gamma to value.

Definition at line 444 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 585 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 590 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 559 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 476 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 689 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 694 of file helpers.h.

◆ increment_time_value()

template<typename T >
bool esphome::increment_time_value ( T &  current,
uint16_t  begin,
uint16_t  end 
)

Definition at line 167 of file time.cpp.

◆ init()

void esphome::init ( )

Definition at line 80 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 93 of file helpers.cpp.

◆ loop_task()

void esphome::loop_task ( void *  pv_params)

Definition at line 66 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 76 of file helpers.h.

◆ micros()

uint32_t esphome::micros ( )

Definition at line 27 of file core.cpp.

◆ millis()

uint32_t esphome::millis ( )

Definition at line 25 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/10]

bool esphome::operator!= ( const StringRef lhs,
const StringRef rhs 
)
inline

Definition at line 99 of file string_ref.h.

◆ operator!=() [2/10]

bool esphome::operator!= ( const StringRef lhs,
const std::string &  rhs 
)
inline

Definition at line 101 of file string_ref.h.

◆ operator!=() [3/10]

bool esphome::operator!= ( const std::string &  lhs,
const StringRef rhs 
)
inline

Definition at line 103 of file string_ref.h.

◆ operator!=() [4/10]

bool esphome::operator!= ( const StringRef lhs,
const char *  rhs 
)
inline

Definition at line 105 of file string_ref.h.

◆ operator!=() [5/10]

bool esphome::operator!= ( const char *  lhs,
const StringRef rhs 
)
inline

Definition at line 107 of file string_ref.h.

◆ operator!=() [6/10]

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!=() [7/10]

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

Definition at line 138 of file optional.h.

◆ operator!=() [8/10]

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

Definition at line 140 of file optional.h.

◆ operator!=() [9/10]

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!=() [10/10]

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/2]

std::string esphome::operator+ ( const char *  lhs,
const StringRef rhs 
)
inline

Definition at line 118 of file string_ref.h.

◆ operator+() [2/2]

std::string esphome::operator+ ( const StringRef lhs,
const char *  rhs 
)
inline

Definition at line 124 of file string_ref.h.

◆ operator+=()

std::string& esphome::operator+= ( std::string &  lhs,
const StringRef rhs 
)
inline

Definition at line 113 of file string_ref.h.

◆ operator<() [1/6]

bool esphome::operator< ( const StringRef lhs,
const StringRef rhs 
)
inline

Definition at line 109 of file string_ref.h.

◆ operator<() [2/6]

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<() [3/6]

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

Definition at line 142 of file optional.h.

◆ operator<() [4/6]

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

Definition at line 144 of file optional.h.

◆ operator<() [5/6]

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<() [6/6]

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/10]

bool esphome::operator== ( const StringRef lhs,
const StringRef rhs 
)
inline

Definition at line 83 of file string_ref.h.

◆ operator==() [2/10]

bool esphome::operator== ( const StringRef lhs,
const std::string &  rhs 
)
inline

Definition at line 87 of file string_ref.h.

◆ operator==() [3/10]

bool esphome::operator== ( const std::string &  lhs,
const StringRef rhs 
)
inline

Definition at line 91 of file string_ref.h.

◆ operator==() [4/10]

bool esphome::operator== ( const StringRef lhs,
const char *  rhs 
)
inline

Definition at line 93 of file string_ref.h.

◆ operator==() [5/10]

bool esphome::operator== ( const char *  lhs,
const StringRef rhs 
)
inline

Definition at line 97 of file string_ref.h.

◆ operator==() [6/10]

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==() [7/10]

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

Definition at line 134 of file optional.h.

◆ operator==() [8/10]

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

Definition at line 136 of file optional.h.

◆ operator==() [9/10]

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==() [10/10]

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 328 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 357 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 361 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 365 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 370 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 380 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 387 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 391 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 304 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 313 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 395 of file helpers.cpp.

◆ progmem_read_byte()

uint8_t esphome::progmem_read_byte ( const uint8_t *  addr)

Definition at line 55 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 215 of file helpers.cpp.

◆ random_float()

float esphome::random_float ( )

Return a random float between 0 and 1.

Definition at line 214 of file helpers.cpp.

◆ random_uint32()

uint32_t esphome::random_uint32 ( )

Return a random 32-bit unsigned integer.

Definition at line 191 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 153 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 222 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 229 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 233 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 453 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 596 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 421 of file helpers.cpp.

◆ str_ctype_transform()

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

Definition at line 271 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 258 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 254 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 277 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 286 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 279 of file helpers.cpp.

◆ str_snprintf()

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

Definition at line 296 of file helpers.cpp.

◆ str_sprintf()

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

Definition at line 310 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 257 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 261 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 264 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 268 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 278 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 80 of file helpers.cpp.

◆ to_string() [2/10]

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

Definition at line 81 of file helpers.cpp.

◆ to_string() [3/10]

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

Definition at line 82 of file helpers.cpp.

◆ to_string() [4/10]

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

Definition at line 83 of file helpers.cpp.

◆ to_string() [5/10]

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

Definition at line 84 of file helpers.cpp.

◆ to_string() [6/10]

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

Definition at line 85 of file helpers.cpp.

◆ to_string() [7/10]

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

Definition at line 86 of file helpers.cpp.

◆ to_string() [8/10]

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

Definition at line 87 of file helpers.cpp.

◆ to_string() [9/10]

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

Definition at line 88 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 270 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 410 of file helpers.cpp.

◆ yield()

void esphome::yield ( )

Definition at line 24 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 32 of file component.cpp.

◆ COMPONENT_STATE_FAILED

const uint32_t esphome::COMPONENT_STATE_FAILED = 0x03

Definition at line 35 of file component.cpp.

◆ COMPONENT_STATE_LOOP

const uint32_t esphome::COMPONENT_STATE_LOOP = 0x02

Definition at line 34 of file component.cpp.

◆ COMPONENT_STATE_MASK

const uint32_t esphome::COMPONENT_STATE_MASK = 0xFF

Definition at line 31 of file component.cpp.

◆ COMPONENT_STATE_SETUP

const uint32_t esphome::COMPONENT_STATE_SETUP = 0x01

Definition at line 33 of file component.cpp.

◆ global_preferences

ESPPreferences * esphome::global_preferences

Definition at line 195 of file preferences.cpp.

◆ global_state

uint32_t esphome::global_state = 0

Definition at line 41 of file component.cpp.

◆ len

std::string size_t esphome::len

Definition at line 292 of file helpers.h.

◆ loop_task_handle

TaskHandle_t esphome::loop_task_handle = nullptr

Definition at line 64 of file core.cpp.

◆ STATUS_LED_ERROR

const uint32_t esphome::STATUS_LED_ERROR = 0x0200

Definition at line 39 of file component.cpp.

◆ STATUS_LED_MASK

const uint32_t esphome::STATUS_LED_MASK = 0xFF00

Definition at line 36 of file component.cpp.

◆ STATUS_LED_OK

const uint32_t esphome::STATUS_LED_OK = 0x0000

Definition at line 37 of file component.cpp.

◆ STATUS_LED_WARNING

const uint32_t esphome::STATUS_LED_WARNING = 0x0100

Definition at line 38 of file component.cpp.