Skip to content

Commit

Permalink
Fix mqtt_basic_async example conf handling (#69)
Browse files Browse the repository at this point in the history
Add domain in the config schema
  • Loading branch information
shanx authored Aug 5, 2024
1 parent 3d9d3a0 commit 8cbb703
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions custom_components/mqtt_basic_async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@
DEFAULT_TOPIC = 'home-assistant/mqtt_example'

# Schema to validate the configured MQTT topic
CONFIG_SCHEMA = vol.Schema({
vol.Optional(CONF_TOPIC, default=DEFAULT_TOPIC): mqtt.valid_subscribe_topic
})
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Optional(
CONF_TOPIC, default=DEFAULT_TOPIC
): mqtt.valid_subscribe_topic
}
)
},
extra=vol.ALLOW_EXTRA,
)


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
Expand Down

0 comments on commit 8cbb703

Please sign in to comment.