ESPHome 2025.5.0
Loading...
Searching...
No Matches
esphome Namespace Reference

Providing packet encoding functions for exchanging data with a remote host. More...

Namespaces

namespace  a01nyub
 
namespace  a02yyuw
 
namespace  a4988
 
namespace  absolute_humidity
 
namespace  ac_dimmer
 
namespace  adalight
 
namespace  adc
 
namespace  adc128s102
 
namespace  addressable_light
 
namespace  ade7880
 
namespace  ade7953_base
 
namespace  ade7953_i2c
 
namespace  ade7953_spi
 
namespace  ads1115
 
namespace  ads1118
 
namespace  ags10
 
namespace  aht10
 
namespace  aic3204
 
namespace  airthings_ble
 
namespace  airthings_wave_base
 
namespace  airthings_wave_mini
 
namespace  airthings_wave_plus
 
namespace  alarm_control_panel
 
namespace  alpha3
 
namespace  am2315c
 
namespace  am2320
 
namespace  am43
 
namespace  analog_threshold
 
namespace  animation
 
namespace  anova
 
namespace  apds9306
 
namespace  apds9960
 
namespace  api
 
namespace  as3935
 
namespace  as3935_i2c
 
namespace  as3935_spi
 
namespace  as5600
 
namespace  as7341
 
namespace  at581x
 
namespace  atc_mithermometer
 
namespace  atm90e26
 
namespace  atm90e32
 
namespace  audio
 
namespace  audio_adc
 
namespace  audio_dac
 
namespace  axs15231
 
namespace  b_parasite
 
namespace  ballu
 
namespace  bang_bang
 
namespace  bedjet
 
namespace  beken_spi_led_strip
 
namespace  bh1750
 
namespace  binary
 
namespace  binary_sensor
 
namespace  binary_sensor_map
 
namespace  bl0906
 
namespace  bl0939
 
namespace  bl0940
 
namespace  bl0942
 
namespace  ble_client
 
namespace  ble_presence
 
namespace  ble_rssi
 
namespace  ble_scanner
 
namespace  bluetooth_proxy
 
namespace  bme280_base
 
namespace  bme280_i2c
 
namespace  bme280_spi
 
namespace  bme680
 
namespace  bme680_bsec
 
namespace  bme68x_bsec2
 
namespace  bme68x_bsec2_i2c
 
namespace  bmi160
 
namespace  bmp085
 
namespace  bmp280_base
 
namespace  bmp280_i2c
 
namespace  bmp280_spi
 
namespace  bmp3xx_base
 
namespace  bmp3xx_i2c
 
namespace  bmp3xx_spi
 
namespace  bmp581
 
namespace  bp1658cj
 
namespace  bp5758d
 
namespace  button
 
namespace  bytebuffer
 
namespace  canbus
 
namespace  cap1188
 
namespace  captive_portal
 
namespace  ccs811
 
namespace  cd74hc4067
 
namespace  ch422g
 
namespace  chsc6x
 
namespace  climate
 
namespace  climate_ir
 
namespace  climate_ir_lg
 
namespace  color_temperature
 
namespace  combination
 
namespace  coolix
 
namespace  copy
 
namespace  cover
 
namespace  cs5460a
 
namespace  cse7761
 
namespace  cse7766
 
namespace  cst226
 
namespace  cst816
 
namespace  ct_clamp
 
namespace  current_based
 
namespace  cwww
 
namespace  dac7678
 
namespace  daikin
 
namespace  daikin_arc
 
namespace  daikin_brc
 
namespace  dallas_temp
 
namespace  daly_bms
 
namespace  dashboard_import
 
namespace  datetime
 
namespace  debug
 
namespace  deep_sleep
 
namespace  delonghi
 
namespace  demo
 
namespace  dfplayer
 
namespace  dfrobot_sen0395
 
namespace  dht
 
namespace  dht12
 
namespace  display
 
namespace  display_menu_base
 
namespace  dps310
 
namespace  ds1307
 
namespace  dsmr
 
namespace  duty_cycle
 
namespace  duty_time_sensor
 
namespace  e131
 
namespace  ee895
 
namespace  ektf2232
 
namespace  emc2101
 
namespace  emmeti
 
namespace  endstop
 
namespace  ens160_base
 
namespace  ens160_i2c
 
namespace  ens160_spi
 
namespace  ens210
 
namespace  es7210
 
namespace  es7243e
 
namespace  es8156
 
namespace  es8311
 
namespace  esp32
 
namespace  esp32_ble
 
namespace  esp32_ble_beacon
 
namespace  esp32_ble_client
 
namespace  esp32_ble_server
 
namespace  esp32_ble_tracker
 
namespace  esp32_camera
 
namespace  esp32_camera_web_server
 
namespace  esp32_can
 
namespace  esp32_dac
 
namespace  esp32_hall
 
namespace  esp32_improv
 
namespace  esp32_rmt_led_strip
 
namespace  esp32_touch
 
namespace  esp8266
 
namespace  esp8266_pwm
 
namespace  ethernet
 
namespace  ethernet_info
 
namespace  event
 
namespace  event_emitter
 
namespace  exposure_notifications
 
namespace  ezo
 
namespace  ezo_pmp
 
namespace  factory_reset
 
namespace  fan
 
namespace  fastled_base
 
namespace  feedback
 
namespace  fingerprint_grow
 
namespace  font
 
namespace  fs3000
 
namespace  ft5x06
 
namespace  ft63x6
 
namespace  fujitsu_general
 
namespace  gcja5
 
namespace  gdk101
 
namespace  globals
 
namespace  gp2y1010au0f
 
namespace  gp8403
 
namespace  gpio
 
namespace  gpio_expander
 
namespace  gps
 
namespace  graph
 
namespace  graphical_display_menu
 
namespace  gree
 
namespace  grove_gas_mc_v2
 
namespace  grove_tb6612fng
 
namespace  growatt_solar
 
namespace  gt911
 
namespace  haier
 
namespace  havells_solar
 
namespace  hbridge
 
namespace  hdc1080
 
namespace  he60r
 
namespace  heatpumpir
 
namespace  hitachi_ac344
 
namespace  hitachi_ac424
 
namespace  hlw8012
 
namespace  hm3301
 
namespace  hmac_md5
 
namespace  hmc5883l
 
namespace  homeassistant
 
namespace  honeywell_hih_i2c
 
namespace  honeywellabp
 
namespace  honeywellabp2_i2c
 
namespace  host
 
namespace  hrxl_maxsonar_wr
 
namespace  hte501
 
namespace  http_request
 
namespace  htu21d
 
namespace  htu31d
 
namespace  hx711
 
namespace  hydreon_rgxx
 
namespace  hyt271
 
namespace  i2c
 
namespace  i2c_device
 
namespace  i2s_audio
 
namespace  iaqcore
 
namespace  ili9xxx
 
namespace  image
 
namespace  improv_base
 
namespace  improv_serial
 
namespace  ina219
 
namespace  ina226
 
namespace  ina260
 
namespace  ina2xx_base
 
namespace  ina2xx_i2c
 
namespace  ina2xx_spi
 
namespace  ina3221
 
namespace  inkbird_ibsth1_mini
 
namespace  inkplate6
 
namespace  integration
 
namespace  internal
 
namespace  internal_temperature
 
namespace  interval
 
namespace  jsn_sr04t
 
namespace  json
 
namespace  kamstrup_kmp
 
namespace  key_collector
 
namespace  key_provider
 
namespace  kmeteriso
 
namespace  kuntze
 
namespace  lcd_base
 
namespace  lcd_gpio
 
namespace  lcd_menu
 
namespace  lcd_pcf8574
 
namespace  ld2410
 
namespace  ld2420
 
namespace  ld2450
 
namespace  ledc
 
namespace  libretiny
 
namespace  libretiny_pwm
 
namespace  light
 
namespace  lightwaverf
 
namespace  lilygo_t5_47
 
namespace  lock
 
namespace  logger
 
namespace  ltr390
 
namespace  ltr501
 
namespace  ltr_als_ps
 
namespace  lvgl
 
namespace  m5stack_8angle
 
namespace  matrix_keypad
 
namespace  max17043
 
namespace  max31855
 
namespace  max31856
 
namespace  max31865
 
namespace  max44009
 
namespace  max6675
 
namespace  max6956
 
namespace  max7219
 
namespace  max7219digit
 
namespace  max9611
 
namespace  mcp23008
 
namespace  mcp23016
 
namespace  mcp23017
 
namespace  mcp23s08
 
namespace  mcp23s17
 
namespace  mcp23x08_base
 
namespace  mcp23x17_base
 
namespace  mcp23xxx_base
 
namespace  mcp2515
 
namespace  mcp3008
 
namespace  mcp3204
 
namespace  mcp4461
 
namespace  mcp4725
 
namespace  mcp4728
 
namespace  mcp47a1
 
namespace  mcp9600
 
namespace  mcp9808
 
namespace  md5
 
namespace  mdns
 
namespace  media_player
 
namespace  mhz19
 
namespace  micro_wake_word
 
namespace  micronova
 
namespace  microphone
 
namespace  mics_4514
 
namespace  midea
 
namespace  midea_ir
 
namespace  mipi_spi
 
namespace  mitsubishi
 
namespace  mixer_speaker
 
namespace  mlx90393
 
namespace  mlx90614
 
namespace  mmc5603
 
namespace  mmc5983
 
namespace  modbus
 
namespace  modbus_controller
 
namespace  monochromatic
 
namespace  mopeka_ble
 
namespace  mopeka_pro_check
 
namespace  mopeka_std_check
 
namespace  mpl3115a2
 
namespace  mpr121
 
namespace  mpu6050
 
namespace  mpu6886
 
namespace  mqtt
 
namespace  mqtt_subscribe
 
namespace  ms5611
 
namespace  ms8607
 
namespace  msa3xx
 
namespace  my9231
 
namespace  nau7802
 
namespace  neopixelbus
 
namespace  network
 
namespace  nextion
 
namespace  nfc
 
namespace  noblex
 
namespace  npi19
 
namespace  ntc
 
namespace  number
 
namespace  one_wire
 
namespace  online_image
 
namespace  opentherm
 
namespace  ota
 
namespace  output
 
namespace  packet_transport
 
namespace  partition
 
namespace  pca6416a
 
namespace  pca9554
 
namespace  pca9685
 
namespace  pcd8544
 
namespace  pcf85063
 
namespace  pcf8563
 
namespace  pcf8574
 
namespace  pid
 
namespace  pipsolar
 
namespace  pm1006
 
namespace  pm2005
 
namespace  pmsa003i
 
namespace  pmsx003
 
namespace  pmwcs3
 
namespace  pn532
 
namespace  pn532_i2c
 
namespace  pn532_spi
 
namespace  pn7150
 
namespace  pn7150_i2c
 
namespace  pn7160
 
namespace  pn7160_i2c
 
namespace  pn7160_spi
 
namespace  power_supply
 
namespace  preferences
 
namespace  prometheus
 
namespace  psram
 
namespace  pulse_counter
 
namespace  pulse_meter
 
namespace  pulse_width
 
namespace  pvvx_mithermometer
 
namespace  pylontech
 
namespace  pzem004t
 
namespace  pzemac
 
namespace  pzemdc
 
namespace  qmc5883l
 
namespace  qmp6988
 
namespace  qr_code
 
namespace  qspi_dbi
 
namespace  qwiic_pir
 
namespace  radon_eye_ble
 
namespace  radon_eye_rd200
 
namespace  rc522
 
namespace  rc522_i2c
 
namespace  rc522_spi
 Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by @glmnet.
 
namespace  rdm6300
 
namespace  remote_base
 
namespace  remote_receiver
 
namespace  remote_transmitter
 
namespace  resampler
 
namespace  resistance
 
namespace  restart
 
namespace  rf_bridge
 
namespace  rgb
 
namespace  rgbct
 
namespace  rgbw
 
namespace  rgbww
 
namespace  rotary_encoder
 
namespace  rp2040
 
namespace  rp2040_pio_led_strip
 
namespace  rp2040_pwm
 
namespace  rpi_dpi_rgb
 
namespace  rtttl
 
namespace  ruuvi_ble
 
namespace  ruuvitag
 
namespace  safe_mode
 
namespace  scd30
 
namespace  scd4x
 
namespace  script
 
namespace  sdl
 
namespace  sdm_meter
 
namespace  sdp3x
 
namespace  sds011
 
namespace  seeed_mr24hpc1
 
namespace  seeed_mr60bha2
 
namespace  seeed_mr60fda2
 
namespace  selec_meter
 
namespace  select
 
namespace  sen0321_sensor
 
namespace  sen21231_sensor
 
namespace  sen5x
 
namespace  senseair
 
namespace  sensirion_common
 
namespace  sensor
 
namespace  servo
 
namespace  setup_priority
 Default setup priorities for components of different types.
 
namespace  sfa30
 
namespace  sgp30
 
namespace  sgp4x
 
namespace  shelly_dimmer
 
namespace  sht3xd
 
namespace  sht4x
 
namespace  shtcx
 
namespace  shutdown
 
namespace  sigma_delta_output
 
namespace  sim800l
 
namespace  slow_pwm
 
namespace  sm10bit_base
 
namespace  sm16716
 
namespace  sm2135
 
namespace  sm2235
 
namespace  sm2335
 
namespace  sm300d2
 
namespace  sml
 
namespace  smt100
 
namespace  sn74hc165
 
namespace  sn74hc595
 
namespace  sntp
 
namespace  socket
 
namespace  sonoff_d1
 
namespace  sound_level
 
namespace  speaker
 
namespace  speed
 
namespace  spi
 
namespace  spi_device
 
namespace  spi_led_strip
 
namespace  sprinkler
 
namespace  sps30
 
namespace  ssd1306_base
 
namespace  ssd1306_i2c
 
namespace  ssd1306_spi
 
namespace  ssd1322_base
 
namespace  ssd1322_spi
 
namespace  ssd1325_base
 
namespace  ssd1325_spi
 
namespace  ssd1327_base
 
namespace  ssd1327_i2c
 
namespace  ssd1327_spi
 
namespace  ssd1331_base
 
namespace  ssd1331_spi
 
namespace  ssd1351_base
 
namespace  ssd1351_spi
 
namespace  st7567_base
 
namespace  st7567_i2c
 
namespace  st7567_spi
 
namespace  st7701s
 
namespace  st7735
 
namespace  st7789v
 
namespace  st7920
 
namespace  statsd
 
namespace  status
 
namespace  status_led
 
namespace  stepper
 
namespace  sts3x
 
namespace  sun
 
namespace  sun_gtil2
 
namespace  switch_
 
namespace  sx1509
 Here you'll find the Arduino code used to interface with the SX1509 I2C 16 I/O expander.
 
namespace  syslog
 
namespace  t6615
 
namespace  tc74
 
namespace  tca9548a
 
namespace  tca9555
 
namespace  tcl112
 
namespace  tcs34725
 
namespace  tee501
 
namespace  teleinfo
 
namespace  tem3200
 
namespace  template_
 
namespace  text
 
namespace  text_sensor
 
namespace  thermostat
 
namespace  time
 
namespace  time_based
 
namespace  tlc59208f
 
namespace  tlc5947
 
namespace  tlc5971
 
namespace  tm1621
 
namespace  tm1637
 
namespace  tm1638
 
namespace  tm1651
 
namespace  tmp102
 
namespace  tmp1075
 
namespace  tmp117
 
namespace  tof10120
 
namespace  tormatic
 
namespace  toshiba
 
namespace  total_daily_energy
 
namespace  touchscreen
 
namespace  tsl2561
 
namespace  tsl2591
 
namespace  tt21100
 
namespace  ttp229_bsf
 
namespace  ttp229_lsf
 
namespace  tuya
 
namespace  tx20
 
namespace  uart
 
namespace  udp
 
namespace  ufire_ec
 
namespace  ufire_ise
 
namespace  uln2003
 
namespace  ultrasonic
 
namespace  update
 
namespace  uponor_smatrix
 
namespace  uptime
 
namespace  valve
 
namespace  vbus
 
namespace  veml3235
 
namespace  veml7700
 
namespace  version
 
namespace  vl53l0x
 
namespace  voice_assistant
 
namespace  voltage_sampler
 
namespace  wake_on_lan
 
namespace  watchdog
 
namespace  waveshare_epaper
 
namespace  web_server
 
namespace  web_server_base
 
namespace  web_server_idf
 
namespace  weikai
 
namespace  weikai_i2c
 
namespace  weikai_spi
 
namespace  whirlpool
 
namespace  whynter
 
namespace  wiegand
 
namespace  wifi
 
namespace  wifi_info
 
namespace  wifi_signal
 
namespace  wireguard
 
namespace  wk2132_i2c
 
namespace  wl_134
 
namespace  wled
 
namespace  x9c
 
namespace  xgzp68xx
 
namespace  xiaomi_ble
 
namespace  xiaomi_cgd1
 
namespace  xiaomi_cgdk2
 
namespace  xiaomi_cgg1
 
namespace  xiaomi_cgpr1
 
namespace  xiaomi_gcls002
 
namespace  xiaomi_hhccjcy01
 
namespace  xiaomi_hhccjcy10
 
namespace  xiaomi_hhccpot002
 
namespace  xiaomi_jqjcy01ym
 
namespace  xiaomi_lywsd02
 
namespace  xiaomi_lywsd02mmc
 
namespace  xiaomi_lywsd03mmc
 
namespace  xiaomi_lywsdcgq
 
namespace  xiaomi_mhoc303
 
namespace  xiaomi_mhoc401
 
namespace  xiaomi_miscale
 
namespace  xiaomi_mjyd02yla
 
namespace  xiaomi_mue4094rt
 
namespace  xiaomi_rtcgq02lm
 
namespace  xiaomi_wx08zm
 
namespace  xl9535
 
namespace  xpt2046
 
namespace  xxtea
 
namespace  yashima
 
namespace  zhlt01
 
namespace  zio_ultrasonic
 
namespace  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  ESPHomeOTAComponent
 ESPHomeOTAComponent provides a simple way to integrate Over-the-Air updates into your app using ArduinoOTA. More...
 
class  ESPPreferenceBackend
 
class  ESPPreferenceObject
 
class  ESPPreferences
 
struct  ESPTime
 A more user-friendly version of struct tm from time.h. 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  ProjectUpdateTrigger
 
class  RAMAllocator
 An STL allocator that uses SPI or internal RAM. 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>
 
Memory management
template<class T >
using ExternalRAMAllocator = RAMAllocator<T>
 

Enumerations

enum class  RetryResult { DONE , 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) noexcept
 
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)
 
uint8_t days_in_month (uint8_t month, uint16_t year)
 
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.
 
bool mqtt_is_connected ()
 Return whether the node has an active connection to an MQTT broker.
 
bool remote_is_connected ()
 Return whether the node has any form of "remote" connection via the API or to an MQTT broker.
 
Mathematics
float lerp (float completion, float start, float end)
 Linearly interpolate between start and end by completion (between 0 and 1).
 
uint8_t crc8 (const uint8_t *data, uint8_t len)
 Calculate a CRC-8 checksum of data with size len using the CRC-8-Dallas/Maxim polynomial.
 
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.
 
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.
 
uint32_t random_uint32 ()
 Return a random 32-bit unsigned integer.
 
float random_float ()
 Return a random float between 0 and 1.
 
bool random_bytes (uint8_t *data, size_t len)
 Generate len number of random bytes.
 
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).
 
Colors
float gamma_correct (float value, float gamma)
 Applies gamma correction of gamma to value.
 
float gamma_uncorrect (float value, float gamma)
 Reverts gamma correction of gamma to value.
 
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).
 
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).
 
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).
 
std::string get_mac_address ()
 Get the device MAC address as a string, in lowercase hex notation.
 
std::string get_mac_address_pretty ()
 Get the device MAC address as a string, in colon-separated uppercase hex notation.
 
void set_mac_address (uint8_t *mac)
 Set the MAC address to use from the provided byte array (6 bytes).
 
bool has_custom_mac_address ()
 Check if a custom MAC address is set (ESP32 & variants)
 
bool mac_address_is_valid (const uint8_t *mac)
 Check if the MAC address is not all zeros or all ones.
 
void IRAM_ATTR HOT delay_microseconds_safe (uint32_t us)
 Delay for the given amount of microseconds, possibly yielding to other processes during the wait.
 
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.
 
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.
 
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.
 
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).
 
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).
 
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).
 
uint8_t reverse_bits (uint8_t x)
 Reverse the order of 8 bits.
 
uint16_t reverse_bits (uint16_t x)
 Reverse the order of 16 bits.
 
uint32_t reverse_bits (uint32_t x)
 Reverse the order of 32 bits.
 
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.
 
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.
 
Units
constexpr float celsius_to_fahrenheit (float value)
 Convert degrees Celsius to degrees Fahrenheit.
 
constexpr float fahrenheit_to_celsius (float value)
 Convert degrees Fahrenheit to degrees Celsius.
 
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.
 
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.
 
Deprecated functions
 ESPDEPRECATED ("hexencode() is deprecated, use format_hex_pretty() instead.", "2022.1") inline std
 
template<typename T >
 ESPDEPRECATED ("hexencode() is deprecated, use format_hex_pretty() instead.", "2022.1") std
 

Variables

TaskHandle_t loop_task_handle = nullptr
 
ESPPreferencesglobal_preferences
 
Application App
 Global storage of Application pointer - only one Application can exist.
 
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
 
const uint32_t WARN_IF_BLOCKING_OVER_MS = 50U
 Initial blocking time allowed without warning.
 
const uint32_t WARN_IF_BLOCKING_INCREMENT_MS = 10U
 How long the blocking time must be larger to warn again.
 
uint32_t global_state = 0
 

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.
 
std::string format_hex (const uint8_t *data, size_t length)
 Format the byte array data of length len in lowercased hex.
 
std::string format_hex (const std::vector< uint8_t > &data)
 Format the vector data in lowercased hex.
 
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.
 
std::string format_hex_pretty (const std::vector< uint8_t > &data)
 Format the vector data in pretty-printed, human-readable hex.
 
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.
 
std::string format_hex_pretty (const std::vector< uint16_t > &data)
 Format the vector data in pretty-printed, human-readable hex.
 
std::string format_bin (const uint8_t *data, size_t length)
 Format the byte array data of length len in binary.
 
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.
 
std::string value_accuracy_to_string (float value, int8_t accuracy_decimals)
 Create a string from a value and an accuracy in decimals.
 
int8_t step_to_accuracy_decimals (float step)
 Derive accuracy in decimals from an increment step.
 
std::string base64_encode (const std::vector< uint8_t > &buf)
 
std::string base64_encode (const uint8_t *buf, size_t buf_len)
 
size_t base64_decode (const std::string &encoded_string, uint8_t *buf, size_t buf_len)
 
std::vector< uint8_t > base64_decode (const std::string &encoded_string)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0>
std::string format_bin (T val)
 Format an unsigned integer in binary, starting with the most significant byte.
 

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.
 
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.
 
bool str_startswith (const std::string &str, const std::string &start)
 Check whether a string starts with a value.
 
bool str_endswith (const std::string &str, const std::string &end)
 Check whether a string ends with a value.
 
std::string str_truncate (const std::string &str, size_t length)
 Truncate a string to a specific length.
 
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).
 
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.
 
std::string str_lower_case (const std::string &str)
 Convert the string to lower case.
 
std::string str_upper_case (const std::string &str)
 Convert the string to upper case.
 
std::string str_snake_case (const std::string &str)
 Convert the string to snake case (lowercase with underscores).
 
std::string str_sanitize (const std::string &str)
 Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores.
 
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).
 
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).
 
std::string size_t std::string __attribute__ ((format(printf, 1, 2))) str_sprintf(const char *fmt
 sprintf-like function returning std::string.
 

Detailed Description

Providing packet encoding functions for exchanging data with a remote host.

When the TEST_COMPONENT flag is defined we include some auto-test methods.

This file implements the UART protocol spoken over the on-board Micro-USB (Type B) connector of Tormatic and Novoferm gates manufactured as of 2016.

Implementation of SPI Controller mode.

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

A transport is required to send the data; this is provided by a child class. The child class should implement the virtual functions send_packet_ and get_max_packet_size_. On receipt of a data packet, it should call this->process_() with the data.

All communication is initiated by the component. The unit doesn't send data without being asked first.

There are two main message types: status requests and commands.

Querying the gate's status:

| sequence | length | type | payload | | 0xF3 0xCB | 0x00 0x00 0x00 0x06 | 0x01 0x04 | 0x00 0x0A 0x00 0x01 | | 0xF3 0xCB | 0x00 0x00 0x00 0x05 | 0x01 0x04 | 0x02 0x03 0x00 |

This request asks for the gate status (0x0A); the only other value observed in the request was 0x0B, but replies were always zero. Presumably this queries another sensor on the unit like a safety breaker, but this is not relevant for an esphome cover component.

The second byte of the reply is set to 0x03 when the gate is in fully open position. Other valid values for the second byte are: (0x0) Paused, (0x1) Closed, (0x2) Ventilating, (0x3) Opened, (0x4) Opening, (0x5) Closing. The meaning of the other bytes is currently unknown and ignored by the component.

Controlling the gate:

| sequence | length | type | payload | | 0x40 0xFF | 0x00 0x00 0x00 0x06 | 0x01 0x06 | 0x00 0x0A 0x00 0x03 | | 0x40 0xFF | 0x00 0x00 0x00 0x06 | 0x01 0x06 | 0x00 0x0A 0x00 0x03 |

The unit acks any commands by echoing back the message in full. However, this does not mean the gate has started closing. The component only considers status replies as authoritative and simply fires off commands, ignoring the echoed messages.

The payload structure is as follows: [0x00, 0x0A] (gate), followed by one of the states normally carried in status replies: (0x0) Pause, (0x1) Close, (0x2) Ventilate (open ~20%), (0x3) Open/high-torque reverse. The protocol implementation in this file simply reuses the GateStatus enum for this purpose.

Used to test the software during development but can also be used in situ to test if the component is working correctly. For release we do not set it by default but you can set it by using the following lines in you configuration file:

platformio_options:
build_flags:
- -DTEST_COMPONENT
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7

Typedef Documentation

◆ enable_if_t

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

Definition at line 94 of file helpers.h.

◆ ExternalRAMAllocator

template<class T >
using esphome::ExternalRAMAllocator = RAMAllocator<T>

Definition at line 787 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

◆ 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

◆ uint24_le_t

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

◆ RetryResult

enum class esphome::RetryResult
strong
Enumerator
DONE 
RETRY 

Definition at line 66 of file component.h.

Function Documentation

◆ __attribute__() [1/4]

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

sprintf-like function returning std::string.

◆ __attribute__() [2/4]

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

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

◆ __attribute__() [3/4]

void esphome::__attribute__ ( (noreturn) )

◆ __attribute__() [4/4]

struct esphome::int24_t esphome::__attribute__ ( (packed) )

◆ 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 83 of file core.cpp.

◆ arch_feed_wdt()

void esphome::arch_feed_wdt ( )

Definition at line 55 of file core.cpp.

◆ arch_get_cpu_cycle_count()

uint32_t esphome::arch_get_cpu_cycle_count ( )

Definition at line 59 of file core.cpp.

◆ arch_get_cpu_freq_hz()

uint32_t esphome::arch_get_cpu_freq_hz ( )

Definition at line 63 of file core.cpp.

◆ arch_init()

void esphome::arch_init ( )

Definition at line 39 of file core.cpp.

◆ arch_restart()

void esphome::arch_restart ( )

Definition at line 31 of file core.cpp.

◆ base64_decode() [1/2]

std::vector< uint8_t > esphome::base64_decode ( const std::string & encoded_string)

Definition at line 517 of file helpers.cpp.

◆ base64_decode() [2/2]

size_t esphome::base64_decode ( const std::string & encoded_string,
uint8_t * buf,
size_t buf_len )

Definition at line 507 of file helpers.cpp.

◆ base64_encode() [1/2]

std::string esphome::base64_encode ( const std::vector< uint8_t > & buf)

Definition at line 465 of file helpers.cpp.

◆ base64_encode() [2/2]

std::string esphome::base64_encode ( const uint8_t * buf,
size_t buf_len )

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

◆ byteswap() [1/9]

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

Definition at line 149 of file helpers.h.

◆ byteswap() [2/9]

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

Definition at line 150 of file helpers.h.

◆ byteswap() [3/9]

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

Definition at line 151 of file helpers.h.

◆ byteswap() [4/9]

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

Definition at line 148 of file helpers.h.

◆ byteswap() [5/9]

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

Definition at line 138 of file helpers.h.

◆ byteswap() [6/9]

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

Definition at line 145 of file helpers.h.

◆ byteswap() [7/9]

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

Definition at line 146 of file helpers.h.

◆ byteswap() [8/9]

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

Definition at line 147 of file helpers.h.

◆ byteswap() [9/9]

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

Definition at line 144 of file helpers.h.

◆ celsius_to_fahrenheit()

float esphome::celsius_to_fahrenheit ( float value)
constexpr

Convert degrees Celsius to degrees Fahrenheit.

Definition at line 482 of file helpers.h.

◆ clamp() [1/2]

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

Definition at line 104 of file helpers.h.

◆ clamp() [2/2]

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

Definition at line 101 of file helpers.h.

◆ convert_big_endian()

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

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

Definition at line 248 of file helpers.h.

◆ convert_little_endian()

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

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

Definition at line 257 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 112 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 152 of file helpers.cpp.

◆ crc8()

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

Calculate a CRC-8 checksum of data with size len using the CRC-8-Dallas/Maxim polynomial.

Definition at line 96 of file helpers.cpp.

◆ days_in_month()

uint8_t esphome::days_in_month ( uint8_t month,
uint16_t year )

Definition at line 8 of file time.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 ( T val)

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

Definition at line 221 of file helpers.h.

◆ delay()

void esphome::delay ( uint32_t ms)

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

◆ delayMicroseconds()

void esphome::delayMicroseconds ( uint32_t us)

Definition at line 30 of file core.cpp.

◆ encode_uint16()

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

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

Definition at line 191 of file helpers.h.

◆ encode_uint24()

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

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

Definition at line 200 of file helpers.h.

◆ encode_uint32()

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

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

Definition at line 195 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 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 216 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 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 206 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 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_printf_() [2/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_vprintf_() [1/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.

◆ esp_log_vprintf_() [2/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.

◆ ESPDEPRECATED() [1/4]

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

Definition at line 810 of file helpers.h.

◆ ESPDEPRECATED() [2/4]

template<typename T >
esphome::ESPDEPRECATED ( "hexencode() is deprecated,
use format_hex_pretty() instead." ,
"2022.1"  )

Definition at line 814 of file helpers.h.

◆ ESPDEPRECATED() [3/4]

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

◆ ESPDEPRECATED() [4/4]

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

◆ fahrenheit_to_celsius()

float esphome::fahrenheit_to_celsius ( float value)
constexpr

Convert degrees Fahrenheit to degrees Celsius.

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

◆ force_link_symbols()

void esphome::force_link_symbols ( )

Definition at line 38 of file core.cpp.

◆ format_bin() [1/2]

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

Format the byte array data of length len in binary.

Definition at line 408 of file helpers.cpp.

◆ format_bin() [2/2]

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

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

Definition at line 434 of file helpers.h.

◆ format_hex() [1/4]

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

Definition at line 413 of file helpers.h.

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

◆ format_hex() [3/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 360 of file helpers.cpp.

◆ format_hex() [4/4]

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

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

Definition at line 409 of file helpers.h.

◆ format_hex_pretty() [1/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 406 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 387 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 389 of file helpers.cpp.

◆ format_hex_pretty() [4/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 372 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 ( T val)

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

Definition at line 426 of file helpers.h.

◆ gamma_correct()

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

Applies gamma correction of gamma to value.

Definition at line 562 of file helpers.cpp.

◆ gamma_uncorrect()

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

Reverts gamma correction of gamma to value.

Definition at line 570 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 726 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 732 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 688 of file helpers.cpp.

◆ has_custom_mac_address()

bool esphome::has_custom_mac_address ( )

Check if a custom MAC address is set (ESP32 & variants)

Returns
True if a custom MAC address is set (ESP32 & variants), else false

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

◆ id() [1/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 803 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 798 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 235 of file time.cpp.

◆ init()

void esphome::init ( )

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

◆ loop_task()

void esphome::loop_task ( void * pv_params)

Definition at line 76 of file core.cpp.

◆ mac_address_is_valid()

bool esphome::mac_address_is_valid ( const uint8_t * mac)

Check if the MAC address is not all zeros or all ones.

Returns
True if MAC is valid, else false

Definition at line 756 of file helpers.cpp.

◆ make_optional()

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

Definition at line 213 of file optional.h.

◆ make_unique()

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

Definition at line 85 of file helpers.h.

◆ micros()

uint32_t esphome::micros ( )

Definition at line 29 of file core.cpp.

◆ millis()

uint32_t esphome::millis ( )

Definition at line 27 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 char * lhs,
const StringRef & rhs )
inline

Definition at line 107 of file string_ref.h.

◆ operator!=() [2/10]

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

Definition at line 103 of file string_ref.h.

◆ operator!=() [3/10]

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

Definition at line 105 of file string_ref.h.

◆ operator!=() [4/10]

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

Definition at line 101 of file string_ref.h.

◆ operator!=() [5/10]

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

Definition at line 99 of file string_ref.h.

◆ operator!=() [6/10]

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

Definition at line 139 of file optional.h.

◆ operator!=() [7/10]

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

Definition at line 137 of file optional.h.

◆ operator!=() [8/10]

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

Definition at line 117 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 167 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 171 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 >
bool esphome::operator< ( nullopt_t ,
optional< T > const & x )
inline

Definition at line 143 of file optional.h.

◆ operator<() [3/6]

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

Definition at line 141 of file optional.h.

◆ operator<() [4/6]

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

Definition at line 121 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 175 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 179 of file optional.h.

◆ operator<=() [1/5]

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

Definition at line 147 of file optional.h.

◆ operator<=() [2/5]

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

Definition at line 145 of file optional.h.

◆ operator<=() [3/5]

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

Definition at line 127 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 183 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 187 of file optional.h.

◆ operator==() [1/10]

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

Definition at line 97 of file string_ref.h.

◆ operator==() [2/10]

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

Definition at line 91 of file string_ref.h.

◆ operator==() [3/10]

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

Definition at line 93 of file string_ref.h.

◆ operator==() [4/10]

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

Definition at line 87 of file string_ref.h.

◆ operator==() [5/10]

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

Definition at line 83 of file string_ref.h.

◆ operator==() [6/10]

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

Definition at line 135 of file optional.h.

◆ operator==() [7/10]

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

Definition at line 133 of file optional.h.

◆ operator==() [8/10]

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

Definition at line 113 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 159 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 163 of file optional.h.

◆ operator>() [1/5]

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

Definition at line 151 of file optional.h.

◆ operator>() [2/5]

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

Definition at line 149 of file optional.h.

◆ operator>() [3/5]

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

Definition at line 125 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 191 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 195 of file optional.h.

◆ operator>=() [1/5]

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

Definition at line 155 of file optional.h.

◆ operator>=() [2/5]

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

Definition at line 153 of file optional.h.

◆ operator>=() [3/5]

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

Definition at line 129 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 199 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 203 of file optional.h.

◆ parse_hex() [1/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 396 of file helpers.h.

◆ parse_hex() [2/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 389 of file helpers.h.

◆ parse_hex() [3/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 341 of file helpers.cpp.

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

◆ parse_hex() [5/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 366 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 std::string & str)

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

Definition at line 400 of file helpers.h.

◆ parse_hex() [7/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 379 of file helpers.h.

◆ parse_hex() [8/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 370 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 313 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 322 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 420 of file helpers.cpp.

◆ progmem_read_byte()

uint8_t esphome::progmem_read_byte ( const uint8_t * addr)

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

◆ random_float()

float esphome::random_float ( )

Return a random float between 0 and 1.

Definition at line 218 of file helpers.cpp.

◆ random_uint32()

uint32_t esphome::random_uint32 ( )

Return a random 32-bit unsigned integer.

Definition at line 196 of file helpers.cpp.

◆ remap()

template<typename T , typename U >
T esphome::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).

Definition at line 162 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]

uint16_t esphome::reverse_bits ( uint16_t x)
inline

Reverse the order of 16 bits.

Definition at line 238 of file helpers.h.

◆ reverse_bits() [2/3]

uint32_t esphome::reverse_bits ( uint32_t x)
inline

Reverse the order of 32 bits.

Definition at line 242 of file helpers.h.

◆ reverse_bits() [3/3]

uint8_t esphome::reverse_bits ( uint8_t x)
inline

Reverse the order of 8 bits.

Definition at line 231 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 579 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 739 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 446 of file helpers.cpp.

◆ str_ctype_transform()

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

Definition at line 284 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 267 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 262 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 290 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 299 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 292 of file helpers.cpp.

◆ str_snprintf()

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

Definition at line 309 of file helpers.cpp.

◆ str_sprintf()

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

Definition at line 323 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 266 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 274 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 277 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 281 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 291 of file helpers.cpp.

◆ swap()

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

Definition at line 209 of file optional.h.

◆ to_string() [1/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 279 of file helpers.h.

◆ to_string() [2/10]

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

Definition at line 89 of file helpers.cpp.

◆ to_string() [3/10]

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

Definition at line 88 of file helpers.cpp.

◆ to_string() [4/10]

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

Definition at line 82 of file helpers.cpp.

◆ to_string() [5/10]

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

Definition at line 90 of file helpers.cpp.

◆ to_string() [6/10]

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

Definition at line 84 of file helpers.cpp.

◆ to_string() [7/10]

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

Definition at line 83 of file helpers.cpp.

◆ to_string() [8/10]

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

Definition at line 87 of file helpers.cpp.

◆ to_string() [9/10]

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

Definition at line 86 of file helpers.cpp.

◆ to_string() [10/10]

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

Definition at line 85 of file helpers.cpp.

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

◆ yield()

void esphome::yield ( )

Definition at line 26 of file core.cpp.

Variable Documentation

◆ App

Application esphome::App

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

Definition at line 170 of file application.cpp.

◆ COLOR_BLACK

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

◆ COLOR_WHITE

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

◆ COMPONENT_STATE_CONSTRUCTION

const uint32_t esphome::COMPONENT_STATE_CONSTRUCTION = 0x00

Definition at line 33 of file component.cpp.

◆ COMPONENT_STATE_FAILED

const uint32_t esphome::COMPONENT_STATE_FAILED = 0x03

Definition at line 36 of file component.cpp.

◆ COMPONENT_STATE_LOOP

const uint32_t esphome::COMPONENT_STATE_LOOP = 0x02

Definition at line 35 of file component.cpp.

◆ COMPONENT_STATE_MASK

const uint32_t esphome::COMPONENT_STATE_MASK = 0xFF

Definition at line 32 of file component.cpp.

◆ COMPONENT_STATE_SETUP

const uint32_t esphome::COMPONENT_STATE_SETUP = 0x01

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

◆ len

std::string size_t esphome::len

Definition at line 301 of file helpers.h.

◆ loop_task_handle

TaskHandle_t esphome::loop_task_handle = nullptr

Definition at line 74 of file core.cpp.

◆ STATUS_LED_ERROR

const uint32_t esphome::STATUS_LED_ERROR = 0x0200

Definition at line 40 of file component.cpp.

◆ STATUS_LED_MASK

const uint32_t esphome::STATUS_LED_MASK = 0xFF00

Definition at line 37 of file component.cpp.

◆ STATUS_LED_OK

const uint32_t esphome::STATUS_LED_OK = 0x0000

Definition at line 38 of file component.cpp.

◆ STATUS_LED_WARNING

const uint32_t esphome::STATUS_LED_WARNING = 0x0100

Definition at line 39 of file component.cpp.

◆ WARN_IF_BLOCKING_INCREMENT_MS

const uint32_t esphome::WARN_IF_BLOCKING_INCREMENT_MS = 10U

How long the blocking time must be larger to warn again.

Definition at line 43 of file component.cpp.

◆ WARN_IF_BLOCKING_OVER_MS

const uint32_t esphome::WARN_IF_BLOCKING_OVER_MS = 50U

Initial blocking time allowed without warning.

Definition at line 42 of file component.cpp.