since the update 2022.12.1 i cant reach my “openMQTTgateway” entities. i am controlling my 433mhz switches.
without changing anything i did get no issues, but also not the entities that i had before.
in configuration.yaml i do: switch: !include switches.yaml
and in switches.yaml i changed this:
You are using to many keys switch->mqtt->switch
In your configuration.yaml you should use: mqtt: !include mqtt.yaml
Create the file mqtt.yaml and put in the entities you want. For example your switch:
the issue is solved. the entities can be founded now but they don´t work. when i click on them, there is no reaction. thats not easy… why do they change working things… damn…
yesterday i did first the programming like you told me. then i had no reaction. after that i did the update to the latest HA version. now the same: no entities anymore and this issue comes:
“Invalid config for [mqtt]: [mqtt] is an invalid option for [mqtt]. Check: mqtt->mqtt->mqtt.”
in configuration.yaml i have this: mqtt: !include mqtt.yaml
filename is correct.
HA does except !include for mqtt!
You can’t leave the mqtt settings part in the file mqtt.yaml, because when the configurations files are merged on startup, you get the double mqtt key and the integration or manual configured devices will not load.
Do you have the mqtt integration installed and working? (see setting->integrations)
Several releases ago the MQTT integration deprecated the old style of specifying entities for an integration. By old style I mean putting the config for those entities under the type of entity (like switch) with a platform key. Essentially doing this was deprecated:
switch:
- platform: mqtt
name: Strom
...
You should’ve seen repairs warning you about this for a number of releases. Recently the deprecation reached end of life, you can no longer specify mqtt entities in that deprecated style. You now must migrate to the new configuration and specify all mqtt entities under the integration key (mqtt). Like this:
mqtt:
switch:
- name: Strom
...
See here for all config details and examples so you can see how to migrate everything.
Also @bertreb is right, having these details in your configuration.yaml does nothing now:
You now configure the broker details in the UI. Any YAML you had specifying those details has been migrated to a config entry and is now entirely managed in the UI. Specifying those details in YAML is deprecated and can be safely removed (since it does nothing now). You have a repair telling you this as well. If you ignore it then eventually that deprecation will also reach end-of-life and in a future release HA will fail to start with an invalid config.
thank you.
i deleted the mqtt settings in configuration.yaml.
so i tried to put the switch directly in configuration.yaml according to the mqtt switch documentation. and now it works.
looks like this:
What is the change you’re trying to make to this which causes an error? What file are you trying to move this switch to and how is that file connected to configuration.yaml via !include?
i tried to put this in file mqtt.yaml or switches.yaml and both caused the issue.
and i tried to load it via !include.
for me its ok now, because it works and i dont have so many things in configuration.yaml so its still clear.
but it would be very interesting which way it has to be outsourced to make it work.
The way !include works is by inserting the contents of the referenced file in that spot. So let’s say you dropped the exact yaml you showed earlier into a file called mqtt.yaml (shortened to simplify):
mqtt:
switch:
- name: Strom
...
And then let’s say you put this in configuration.yaml:
mqtt: !include mqtt.yaml
That’s the exact same thing as putting this in your configuration.yaml:
mqtt:
mqtt:
switch:
- name: Strom
...
Obviously that’s not correct. It’s different then what you had in configuration.yaml before, mqtt is in there twice.
I don’t know what you put in configuration.yaml when you tried to use !include because you didn’t show me. But whenever you use !include that’s how it works. The only actual config file is configuration.yaml, when you use !include HA assembles the real file by copying the contents of files into that spot. If your config doesn’t make sense when you do that then something is incorrect.