mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
3bca31ba9fc9014b7b8a575a09b3e7f8825d7a0c
The custom optional implementation (from optional-bare, 2017) predates C++17. All ESPHome platforms now compile with gnu++20, making std::optional available everywhere. The custom implementation had several issues: - No emplace() support - Always default-constructs value_ (wasteful for non-trivial types) - reset() only flips a bool without destroying the value - No move semantics - Requires T to be default constructible Replace with using aliases (using std::optional, using std::nullopt, etc.) so all existing code using esphome::optional continues to work. Also fix ~30 unsafe .value() calls across climate IR components that relied on the custom optional's behavior of returning a default-constructed value when empty. With std::optional, accessing an empty optional is UB. These are replaced with value_or() using appropriate defaults (CLIMATE_FAN_AUTO, CLIMATE_PRESET_NONE).
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
598 MiB
Languages
C++
55.7%
Python
43.7%
C
0.3%
JavaScript
0.2%
