Hello,
I am stuck with the use of the new MQTT format.
I have in my configuration an inclusion for the sensors to a separate sensor.yaml file which looks like below.
in the configuration.yaml:
sensor: !include sensors.yaml
In the sensors.yaml file:
- platform: mqtt
state_topic: "ITHO/Fan/State"
name: Fan Speed
However after the update with the new format I get this warning:
Your manually configured MQTT sensor(s) needs attention
This stops working in version 2022.12.0. Please address before upgrading.
Manually configured MQTT sensor(s) found under platform key sensor.
Please move the configuration to the mqtt integration key and restart Home Assistant to fix this issue. See the documentation, for more information.
I tried to fit in the new format in the sensors.yaml file but I can not find the correct notation to put it in there.
Does this mean I have to move all sensor configs back to the configuration.yaml ?
There is no clear documentation regarding this new format in cinjunction with a separated sensor file
Look at how you specified where your sensor entities are defined.
sensor: !include sensors.yaml
You can now do the same thing for entities based on the MQTT integration.
mqtt: !include mqtt.yaml
The mqtt.yaml file can contain all your MQTT-based entities (sensor, binary_sensor, light, etc). You can even split up the information into separate files but you must use a different !include directive for that.
Sample contents of mqtt.yaml
sensor:
- name: Fan Speed
state_topic: "ITHO/Fan/State"
- name: Something Else
state_topic: "home/whatever"
- name: Yet Another Sensor
state_topic: "etc/foo"
There’s an entire chapter in the documentation that explains how to split your configuration. Splitting the mqtt configuration into one or more files follows the rules explained here:
Thank you very much !
That is what you get when you have configured HA for a while now and not have touched it for a long time because of other priorities unfortunately. But I am very thankful for such a great community HA has !
I managed to create also a separate mqqt file like you said and added the entities and sensors in there.
Thanks again for pointing this out
Now multiples files in mqtt folder for different tasks. Each can contain multples switches, sensors, etc in the same file, but only one ‘sensor:’ line and only one ‘switch:’ line. If you repeat the ‘sensor:’ header on each paragraph, it will no load. (i had to hit my head to the wall to realize that).
The mqtt yaml is totally inconsistent.
Why is mqtt handle so different that other platforms?
Why do I have to have a yaml file for sensors and a different file for mqtt if both files define sensors.
I would like to understand the logic behind this.
the old definition
- platform: mqtt
state_topic: "ITHO/Fan/State"
name: Fan Speed`