Include stanza for mqtt error

I’m trying to move my mqtt stuff out of configuration.yaml into it’s own file called mqtt.yaml, but I’m not having much luck.

When I run the Developer Tools → Check Configuration, it fails with the error:
Invalid config for [mqtt]: [name] is an invalid option for [mqtt]. Check: mqtt->mqtt->0->name. (See /config/configuration.yaml, line 15).

My configuration.yaml files looks like this:

# Loads default set of integrations. Do not remove.

# Load frontend themes from the themes folder
   themes: !include_dir_merge_named themes
# Text to speech
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt: !include mqtt.yaml

  - name: send_email
    platform: smtp
    encryption: starttls
    verify_ssl: false
    sender: [email protected]
    sender_name: "Home Assistant"
    recipient: [email protected]
    port: 587
    username: ha
    password: xxxxxx

I’ve tried naming the mqtt.yaml file to something else. I’ve tried moving the mqtt include stanza to the bottom of the file. Nothing works.

I’m on version:

Home Assistant 2023.10.5
Supervisor 2023.10.0
Operating System 11.0
Frontend 20231005.0 - latest

Any help would be appreciated.

Seems correct. The error is probably in your mqtt.yaml file.

I think your mqtt.yaml file starts with


and if so, that line needs to be removed.

My mqtt.yaml file looks like this – appologies for not including it in my original post. It doesn’t have the mqtt: stanza in it…

- sensor:
  name: "Generator Battery"
  state_topic: 'generator/Status/Engine/Battery Voltage'
  unit_of_measurement: "V"
  value_template: '{{ value | regex_replace(" V", "") | float }}'
     - name: "Generator Battery"
       state_topic: "generator/Status/Engine/Battery Voltage"
       unit_of_measurement: "V"
       value_template: '{{ value | regex_replace(" V", "") | float }}'
    - name: "second sensor"
      state_topic: "second topic"

That worked. Thank you!!!