WTH happened to mqtt config.yaml?

Can we add yaml config options back to configuration.yaml, please?

This…

states that ’ * Integrations that integrate transports. These integrations allow users to define their own protocol, e.g., MQTT, serial, GPIO.’, will continue having support for yaml configuration.

Face it: It’s gone. So is the availability to provision a HA instance from scratch (e.g. for container usage).

It‘s the future.

Mqtt yaml still exists. It’s format is changing in 2022.9 and will continue to exist in that new format.

Nah… maybe enough people asking for the same will make a difference? :slight_smile:

Not really understanding, if you want to configure MQTT in YAML you basically can. The only piece that’s been entirely removed from YAML is the actual connection details for the broker. But that was removed several releases ago? Are you asking for that back?

Also you’re quoting a 2 year old blog post. Blog posts are written to introduce something at the time and describe the current state of things. They aren’t updated because they aren’t documentation. The decision about YAML config is ADR-10 which says this:

  • Integrations that communicate with devices and/or services are only configured via the UI. In rare cases, we can make an exception.
  • All other integrations are configured via YAML or via the UI.

The only hard and fast rule it establishes is that integrations which communicate with devices and services will be UI-configurable only going forward. For all other integrations it leaves the decision up to the code owner. It does not require any integration be configured in YAML.

I know it still exists, partly anyways. I’m asking for the complete config options… broker address, birth/will topics, etc.

I’m not sure why certain options were removed as the config.yaml options can be imported into the new way, like it was done up until certain options were removed?

Because it means if your entities are entirely created using MQTT discovery you can fully configure MQTT in the UI. Simply by defining the connection details to the broker many users are done, no other config required.

Manual MQTT entities are quite complex with templates and things so it is left as a YAML task.

@petro

If I add this to .storage/core.config_entries will it install and load the mqtt integration?

                "entry_id": "91af06998d822e266759d8f26d431ef3",
                "version": 1,
                "domain": "mqtt",
                "title": "localhost",
                "data": {
                    "broker": "localhost",
                    "port": 1883,
                    "username": "ha",
                    "password": "ha",
                    "birth_message": {
                        "topic": "homeassistant/status",
                        "payload": "online",
                        "qos": 0,
                        "retain": true
                    },
                    "will_message": {
                        "topic": "homeassistant/status",
                        "payload": "offline",
                        "qos": 0,
                        "retain": true
                    },
                    "discovery": false
                },
                "options": {},
                "pref_disable_new_entities": false,
                "pref_disable_polling": false,
                "source": "integration_discovery",
                "unique_id": null,
                "disabled_by": null
            }

This is what mine looks like and was imported from configuration.yaml when the config was migrated to the UI:

              {
                "entry_id": "7f1307e8ada1aa99d78d08f2e8adb7a8",
                "version": 1,
                "domain": "mqtt",
                "title": "configuration.yaml",
                "data": {
                    "broker": "192.168.1.11",
                    "port": 1883,
                    "username": "not_real",
                    "password": "not_real",
                    "birth_message": {
                        "topic": "homeassistant/status",
                        "payload": "online",
                        "qos": 0,
                        "retain": false
                    },
                    "will_message": {
                        "topic": "homeassistant/status",
                        "payload": "offline",
                        "qos": 0,
                        "retain": false
                    },
                    "discovery": true
                },
                "options": {},
                "pref_disable_new_entities": false,
                "pref_disable_polling": false,
                "source": "import",
                "unique_id": null,
                "disabled_by": null
            },

what options are you missing in yours now?

Not missing anything in the .storage file, that I know of.

What I want to know is… Can I configure mqtt if I added an mqtt section to configuration.yaml, put the file in .storage to set options no longer available in yaml, like broker, birth/will, port, etc, then restart?

Yep you can, but it’ll be trial and error if you don’t know JSON. Also, if the data changes in the future, and you set the outdated json, home assistant won’t start. You’ll have to decipher the python errors at that point.

Right on. Thanks for the confirmation, appreciate ya. I’ll give it a go.

You call that a confirmation?

I confirmed that he can set the configuration the way he wants. It’s just not yaml. What else are you expecting?

Yeah, technically you did confirm, that it’s doable. While at the same time warning that it’s not really feasible, as it’s “trial and error”, may change in the future, will probably break HA, will cause errors.

HA Architecture Board has decided, that the future of YAML is none. It’s perfectly understandable for a “convenient” product targeting at less technical experienced users, gasping for an UI to configure things. But it prevents provisioning a blank instance, even with a basic configuration.

Just name it, it’s okay. It has been announced.

It’s not trial and error if you know JSON. This is how I manage my config. It’s trial and error if you don’t want to learn and understand JSON. Secondly, it’s literally no different if a yaml configuration changed. You’d have to update your config.

@m0wlheld

I feel you. Personally, I believe both yaml and ui should be provided as configuration options.

As to the confirmation comment, all I wanted to know is would it work. I understand json and know how to create/update json with python, so editing the file shouldn’t be a problem.