Adding multiple devices to HA

Dear forum,

I am following this document:

Part 2: Style 2: List each device separately
This is some thing I cannot get toe work:

currently running HA supervisot 227 and core: HassOS 3.13

When I follow the instruction:
I have added in the configuration.yaml

mqtt:
broker: 192.168.0.3
keepalive: 60
discovery: true
discovery_prefix: homeassistant

sensor: !include mqtt-sensors.yaml

It works fine when mqtt-sensors.yaml contains:

  • platform: mqtt
    name: “sn-163: Temperature”

entity_id: “sensor.temperature_163”

state_topic: "sn-163/fd/Temperature"
unit_of_measurement: 'C'
unique_id: "sn-163: Temperature"
icon: mdi:temperature-celsius
availability_topic: "sn-163/fd/availability"
payload_available: "online"
payload_not_available: "offline"
  • platform: mqtt
    name: “sn-163: Temperature”

entity_id: “sensor.temperature_163”

state_topic: "sn-163/fd/Temperature"
unit_of_measurement: 'C'
unique_id: "sn-163: Temperature"
icon: mdi:temperature-celsius
availability_topic: "sn-163/fd/availability"
payload_available: "online"
payload_not_available: "offline"

when I add:

sensor bedroom:
  platform: mqtt

its broken:
Error loading /config/configuration.yaml: expected ‘’, but found ‘’
in “/config/mqtt-sensors.yaml”, line 694, column 1

First off you need to make sure you properly format your code for the forum. put three backticks (```) on the line both before and after your code.

But to your issue.

as far as I know you can’t do both methods of config at the same time.

the !include statement adds the code in that file just as if you added it directly under the intial key in configuration.yaml.

So the way you have it now it will look like the when the !include is processed:

mqtt:
  broker: 192.168.0.3 
  keepalive: 60
  discovery: true
  discovery_prefix: homeassistant

sensor: #!include mqtt-sensors.yaml -> everything past here is from the included file
  platform: mqtt
  name: “sn-163: Temperature”

  sensor bedroom:
    platform: mqtt

If you notice the indentation you should see why it won’t work.

Which is also why the code needs formatted properly when posting so we can see the formatting and fix any issues there.

Also I can’t really tell from your formatting but it looks like you have the same mqtt sensor included twice (sn-163: Temperature)

Thanks Finity I will do next time.

Got it I was investigating which one to use. For me it is understanding how HA works
Never the 2 method’s combined or at the same time but thanks for clarify this.

I understand and agree that my question or remark was not clear enough. My apologies for this. I got it working now thanks to your remarks