1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-27 15:42:22 +01:00

Allow entity names to be set to None (#4607)

* Allow entity names to be set to None so they take on the device friendly_name automatically

* Use empty
This commit is contained in:
Jesse Hills
2023-03-27 11:49:09 +13:00
committed by GitHub
parent 56504692af
commit c2756d57d8
5 changed files with 67 additions and 24 deletions

View File

@@ -22,20 +22,12 @@ ESP32ImprovComponent = esp32_improv_ns.class_(
)
def validate_none_(value):
if value in ("none", "None"):
return None
if cv.boolean(value) is False:
return None
raise cv.Invalid("Must be none")
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32ImprovComponent),
cv.GenerateID(CONF_BLE_SERVER_ID): cv.use_id(esp32_ble_server.BLEServer),
cv.Required(CONF_AUTHORIZER): cv.Any(
validate_none_, cv.use_id(binary_sensor.BinarySensor)
cv.none, cv.use_id(binary_sensor.BinarySensor)
),
cv.Optional(CONF_STATUS_INDICATOR): cv.use_id(output.BinaryOutput),
cv.Optional(