Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot setup mqtt_basic_async #39

Open
tanasecosminromeo opened this issue Oct 16, 2022 · 3 comments
Open

Cannot setup mqtt_basic_async #39

tanasecosminromeo opened this issue Oct 16, 2022 · 3 comments

Comments

@tanasecosminromeo
Copy link

Steps to reproduce.

  • Clone repo
  • Move example-custom-config/custom_components/mqtt_basic_async to custom_components
  • Restart HA
  • Add below to configuration.yaml
mqtt_basic_async:
  topic: "home-assistant/mqtt_example"
  • Go to Developer Tools and click check configuration to get:
Invalid config for [mqtt_basic_async]: [default_config] is an invalid option for [mqtt_basic_async]. Check: mqtt_basic_async->default_config. (See /config/configuration.yaml, line 29).

which is the 1st line in my configuration.yaml file.

Any ideas? I want to listen to some topics and update some sensors, already have these in sensors.yaml and they work fine, but I would like to develop a more complex integration, and this would be my 1st step :D

@thecode
Copy link
Member

thecode commented Oct 16, 2022

Yes, this example is outdated, if you change:

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

to:

CONFIG_SCHEMA = vol.Schema(
    {vol.Optional(CONF_TOPIC, default=DEFAULT_TOPIC): mqtt.valid_subscribe_topic},
    extra=vol.ALLOW_EXTRA,
)

It will resolve the error and create the entity, but there other errors in this example so I would not use that as a baseline
Let's keep this issue open, I will try to make a new example.

@tanasecosminromeo
Copy link
Author

Thank you @thecode - I should rtfm before trying out examples 🤣 . Do you want me to make a PR after I get a working version?

@thecode
Copy link
Member

thecode commented Oct 18, 2022

PRs are always welcomed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants