macW
October 7, 2022, 1:13pm
1
The recent changes to MQTT setup in configuration.yaml (moving from sensors: to the new mqtt:) really confused me. My system went from working fine to throwing a warning that I need to change my setup to the new style before the next release (or something like that). So I went through config edits, and thought I had it all working. No dice. I didn’t make a backup, of course. Eventually I rolled back to a disk image I made from a few days earlier.
Anyway, WTH? Why change something if it isn’t broken? Why can’t the two config methods live in harmony? I probably have some weird non-standard coding that doesn’t jibe with the new stuff. I’m wondering if anyone else has faced this issue.
123
(Taras)
October 7, 2022, 1:28pm
2
The change to the new format was implemented in 2022.6.0 and indicated the old format would cease to function in 2022.9.0.
The explanation is found in the Pull Request that implemented it .
2 Likes
francisp
(Francis)
October 7, 2022, 1:42pm
3
I thought I had converted them all, and still got a warning. Eventually found out is were sensors declared in a package.
finity
October 7, 2022, 1:50pm
4
I REALLY don’t get why people are making this so hard.
it’s literally going from this:
sensor:
- platform: mqtt
name: etc
binary_sensor:
- platform: mqtt
name: etc_2
to this:
mqtt:
sensor:
- name: etc
binary_sensor:
- name: etc_2
1 Like
maxym
October 7, 2022, 2:21pm
5
I think OP may be just asking “why”
Personally I found migration not any complicated but would like to know the reasons behind the change.
petro
(Petro)
October 7, 2022, 2:24pm
6
It was never mapped, it’s deserialized in order received. That didn’t change, so there’s nothing to fear.
petro
(Petro)
October 7, 2022, 2:34pm
7
all of this has been accessible since the decision was made, in april 2020.
# 7. Config YAML structure for integrations
Date: 2020-04-05
## Status
Accepted
---
## Context
There are currently many different ways of structuring an integration and its config in Home Assistant. We allow config YAML, either under the integration key or under platform keys with the integration name. We allow a config flow with configuration entered via the GUI, stored in config entries. We allow importing config YAML to a config entry via config flow.
This ADR focuses on the configuration YAML structure and its use in integrations.
The many options for configuration impact how the integration is structured and what Home Assistant backend APIs are used.
1. Integrations that only have a single platform, place the configuration under a platform key and use `async_setup_platform` to set up the platform.
2. Integrations that have multiple platforms, sometimes centralize the configuration to the integration domain name key and load platforms via `discovery.async_load_platform`, which in turn calls `async_setup_platform`.
This file has been truncated. show original
1 Like
finity
October 7, 2022, 3:11pm
8
Yes in the second part of the post the question was “why?”.
But I would guess that was only prompted by all of the struggles explained in the longer first paragraph.
maxym
October 7, 2022, 3:25pm
9
thanks for the link. The rationale presented in the article explains the change pretty well.
it seems it was waiting for new changes in order to start refactoring (I think there were changes in mqtt light at the same time)
petro
(Petro)
October 7, 2022, 3:26pm
10
That repo has all the guidelines that HA has set about development of HA.
macW
October 7, 2022, 5:44pm
11
Well, that’s not so friendly, @finity ! The fact that I had to come to the WTH posts after searching means it’s not such common knowledge at all! That was one point. I don’t go to the source code for documentation.
petro
(Petro)
October 7, 2022, 6:00pm
13
Closing because the reasoning is listed above