|
ESPHome 2026.5.1
|
Go to the source code of this file.
Namespaces | |
| namespace | esphome |
Functions | |
| void | esphome::__attribute__ ((noinline, cold)) WarnIfComponentBlockingGuard |
| esphome::if (data) | |
| float | esphome::gamma_correct (float value, float gamma) |
| float | esphome::gamma_uncorrect (float value, float gamma) |
Mathematics | |
| uint8_t | esphome::crc8 (const uint8_t *data, uint8_t len, uint8_t crc=0x00, uint8_t poly=0x8C, bool msb_first=false) |
Calculate a CRC-8 checksum of data with size len. | |
| uint16_t | esphome::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 | esphome::crc16be (const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout) |
| uint32_t | esphome::fnv1_hash (const char *str) |
Calculate a FNV-1 hash of str. | |
| uint32_t | esphome::random_uint32 () |
| Return a random 32-bit unsigned integer. | |
| float | esphome::random_float () |
| Return a random float between 0 and 1. | |
| int8_t | esphome::ilog10 (float value) |
| Compute floor(log10(fabs(value))) using iterative comparison. | |
Parsing & formatting | |
| 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. | |
| char * | esphome::uint32_to_str_unchecked (char *buf, uint32_t val) |
| Write unsigned 32-bit integer to buffer (internal, no size check). | |
| char * | esphome::format_hex_to (char *buffer, size_t buffer_size, const uint8_t *data, size_t length) |
| Format byte array as lowercase hex to buffer (base implementation). | |
| char * | esphome::format_hex_pretty_to (char *buffer, size_t buffer_size, const uint8_t *data, size_t length, char separator=':') |
| Format byte array as uppercase hex to buffer (base implementation). | |
| char * | esphome::format_hex_pretty_to (char *buffer, size_t buffer_size, const uint16_t *data, size_t length, char separator=':') |
| Format uint16_t array as uppercase hex with separator to pre-allocated buffer. | |
| char * | esphome::format_bin_to (char *buffer, size_t buffer_size, const uint8_t *data, size_t length) |
| Format byte array as binary string to buffer. | |
| ParseOnOffState | esphome::parse_on_off (const char *str, const char *on=nullptr, const char *off=nullptr) |
| Parse a string that contains either on, off or toggle. | |
| size_t | esphome::value_accuracy_to_buf (std::span< char, VALUE_ACCURACY_MAX_LEN > buf, float value, int8_t accuracy_decimals) |
| Format value with accuracy to buffer, returns chars written (excluding null) | |
| size_t | esphome::value_accuracy_with_uom_to_buf (std::span< char, VALUE_ACCURACY_MAX_LEN > buf, float value, int8_t accuracy_decimals, StringRef unit_of_measurement) |
| Format value with accuracy and UOM to buffer, returns chars written (excluding null) | |
| int8_t | esphome::step_to_accuracy_decimals (float step) |
| Derive accuracy in decimals from an increment step. | |
| size_t | esphome::base64_decode (const std::string &encoded_string, uint8_t *buf, size_t buf_len) |
| size_t | esphome::base64_decode (const uint8_t *encoded_data, size_t encoded_len, uint8_t *buf, size_t buf_len) |
| bool | esphome::base64_decode_int32_vector (const std::string &base64, std::vector< int32_t > &out) |
| Decode base64/base64url string directly into vector of little-endian int32 values. | |
Colors | |
| 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). | |
| 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). | |
System APIs | |
| void | esphome::get_mac_address_into_buffer (std::span< char, MAC_ADDRESS_BUFFER_SIZE > buf) |
| Get the device MAC address into the given buffer, in lowercase hex notation. | |
| const char * | esphome::get_mac_address_pretty_into_buffer (std::span< char, MAC_ADDRESS_PRETTY_BUFFER_SIZE > buf) |
| Get the device MAC address into the given buffer, in colon-separated uppercase hex notation. | |
| bool | esphome::has_custom_mac_address () |
| Check if a custom MAC address is set (ESP32 & variants) | |
| bool | esphome::mac_address_is_valid (const uint8_t *mac) |
| Check if the MAC address is not all zeros or all ones. | |
| void | esphome::delay_microseconds_safe (uint32_t us) |
| Delay for the given amount of microseconds, possibly yielding to other processes during the wait. | |
Variables | |
| uint16_t uint16_t & | esphome::capacity = new_cap |
| uint16_t uint16_t size_t | esphome::elem_size |
| uint16_t | esphome::new_cap = size + 1 |
| auto * | esphome::new_data = ::operator new(new_cap *elem_size) |
Strings | |
| uint16_t | esphome::size |
| bool | esphome::str_equals_case_insensitive (const std::string &a, const std::string &b) |
| Compare strings for equality in case-insensitive manner. | |
| bool | esphome::str_equals_case_insensitive (StringRef a, StringRef b) |
| Compare StringRefs for equality in case-insensitive manner. | |
| bool | esphome::str_startswith (const std::string &str, const std::string &start) |
| Check whether a string starts with a value. | |
| bool | esphome::str_endswith (const std::string &str, const std::string &end) |
| Check whether a string ends with a value. | |
| bool | esphome::str_endswith_ignore_case (const char *str, size_t str_len, const char *suffix, size_t suffix_len) |
| Case-insensitive check if string ends with suffix (no heap allocation). | |
| char * | esphome::str_sanitize_to (char *buffer, size_t buffer_size, const char *str) |
| Sanitize a string to buffer, keeping only alphanumerics, dashes, and underscores. | |
| size_t | esphome::make_name_with_suffix_to (char *buffer, size_t buffer_size, const char *name, size_t name_len, char sep, const char *suffix_ptr, size_t suffix_len) |
| Zero-allocation version: format name + separator + suffix directly into buffer. | |
| std::string | esphome::make_name_with_suffix (const char *name, size_t name_len, char sep, const char *suffix_ptr, size_t suffix_len) |
| Optimized string concatenation: name + separator + suffix (const char* overload) Uses a fixed stack buffer to avoid heap allocations. | |
| std::string | esphome::make_name_with_suffix (const std::string &name, char sep, const char *suffix_ptr, size_t suffix_len) |
| Concatenate a name with a separator and suffix using an efficient stack-based approach. | |