Exclude entity_category from YAML and discovery export

This commit is contained in:
jbouwh 2025-06-25 13:06:53 +00:00
parent 5b47d83351
commit 11b0b2bd3d

View File

@ -564,6 +564,8 @@ SUPPORTED_COLOR_MODES_SELECTOR = SelectSelector(
)
)
EXCLUDE_FROM_CONFIG_IF_NONE = {CONF_ENTITY_CATEGORY}
@callback
def validate_cover_platform_config(
@ -3189,6 +3191,9 @@ class MQTTSubentryFlowHandler(ConfigSubentryFlow):
component_config.update(
self._subentry_data["device"].get("mqtt_settings", {}).copy()
)
for field in EXCLUDE_FROM_CONFIG_IF_NONE:
if field in component_config and component_config[field] is None:
component_config.pop(field)
mqtt_yaml_config.append({platform: component_config})
yaml_config = yaml.dump(mqtt_yaml_config_base)
@ -3237,6 +3242,9 @@ class MQTTSubentryFlowHandler(ConfigSubentryFlow):
component_config.update(
self._subentry_data["device"].get("mqtt_settings", {}).copy()
)
for field in EXCLUDE_FROM_CONFIG_IF_NONE:
if field in component_config and component_config[field] is None:
component_config.pop(field)
discovery_payload["cmps"][component_id] = component_config
data_schema = vol.Schema(