1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-05 21:02:20 +01:00

Add LWIP optimization options to reduce flash usage (#8946)

Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
This commit is contained in:
J. Nick Koston
2025-06-09 01:08:10 -05:00
committed by GitHub
parent 368a0eea8a
commit b7ca6e087a
3 changed files with 67 additions and 5 deletions

View File

@@ -1667,6 +1667,26 @@ class OnlyWith(Optional):
pass
class OnlyWithout(Optional):
"""Set the default value only if the given component is NOT loaded."""
def __init__(self, key, component, default=None):
super().__init__(key)
self._component = component
self._default = vol.default_factory(default)
@property
def default(self):
if self._component not in CORE.loaded_integrations:
return self._default
return vol.UNDEFINED
@default.setter
def default(self, value):
# Ignore default set from vol.Optional
pass
def _entity_base_validator(config):
if CONF_NAME not in config and CONF_ID not in config:
raise Invalid("At least one of 'id:' or 'name:' is required!")