Allow extra keys in MQTT discovery messages (#58390)
* Allow extra keys in MQTT discovery messages * Remove extra keys
This commit is contained in:
parent
a8a8b532d0
commit
640a7fee9d
44 changed files with 628 additions and 480 deletions
|
@ -58,6 +58,8 @@ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend(
|
|||
}
|
||||
).extend(MQTT_ENTITY_COMMON_SCHEMA.schema)
|
||||
|
||||
DISCOVERY_SCHEMA = PLATFORM_SCHEMA.extend({}, extra=vol.REMOVE_EXTRA)
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
|
@ -72,7 +74,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
setup = functools.partial(
|
||||
_async_setup_entity, hass, async_add_entities, config_entry=config_entry
|
||||
)
|
||||
await async_setup_entry_helper(hass, binary_sensor.DOMAIN, setup, PLATFORM_SCHEMA)
|
||||
await async_setup_entry_helper(hass, binary_sensor.DOMAIN, setup, DISCOVERY_SCHEMA)
|
||||
|
||||
|
||||
async def _async_setup_entity(
|
||||
|
@ -101,7 +103,7 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity):
|
|||
@staticmethod
|
||||
def config_schema():
|
||||
"""Return the config schema."""
|
||||
return PLATFORM_SCHEMA
|
||||
return DISCOVERY_SCHEMA
|
||||
|
||||
def _setup_from_config(self, config):
|
||||
value_template = self._config.get(CONF_VALUE_TEMPLATE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue