New MQTT YAML failure

Just a random quick question,

I see that the old way of doing MQTT manual entries is to be killed off soon so I would like to start migrating things, just wanted to run things past people far smarter than myself to see what I am doing wrong as I can’t seem to get them to work, I am using a rather strange setup as I have fully broken my config out in to separate files:


image

My confuguration.yaml loads packages, one of which is my MQTT.yaml

#####
# This loads up my MQTT configurations.
#
# https://www.home-assistant.io/integrations/mqtt/
#####

MQTT: !include_dir_list ../entities/mqtt

This bit seems OK, now my old formatting for a light for example is this and doesn’t throw any errors when checking the YAML

#####
# MQTT - Manual MQTT entry for a Shelly Duo RGB Bulb
# https://www.home-assistant.io/integrations/mqtt
#####

light: mqtt_living_room_ceiling
name: "Living Room Ceiling Bulb MQTT"
unique_id: living_room_ceiling_bulb_mqtt
state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0"
command_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/command"
brightness_state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/status"
brightness_value_template: "{{ value_json.gain | float | multiply(2.55) | round(0) }}"
qos: 0
payload_on: "on"
payload_off: "off"
optimistic: false

But when I try and do what I think is the new format based on an example found here it throws an error

The code tried is:

#####
# MQTT - Manual MQTT entry for a Shelly Duo RGB Bulb
# https://www.home-assistant.io/integrations/mqtt
#####

light:
  - name: "Living Room Ceiling Bulb MQTT"
    unique_id: living_room_ceiling_bulb_mqtt
    state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0"
    command_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/command"
    brightness_state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/status"
    brightness_value_template: "{{ value_json.gain | float | multiply(2.55) | round(0) }}"
    qos: 0
    payload_on: "on"
    payload_off: "off"
    optimistic: false

I get the below error:

Configuration validation
Validate your configuration if you recently made some changes to it and want to make sure that it is all valid.
Configuration invalid!

Package mqtt setup failed. Component MQTT Integration 'MQTT' not found.

I do indeed have the MQTT integration installed and running as it picks up and auto adds a number of devices already:
image

Not sure what I am doing wrong, anyone have any ideas?

System info:

Home Assistant Core 2022.6.0
Home Assistant Supervisor 2022.05.3
Home Assistant OS 8.0

Actually I’ve just realised it’s not liking the MQTT.yaml file, if I comment out MQTT: !include_dir_list ../entities/mqtt then it’s fine, but if I try to use it then I get the Component MQTT Integration error, is the new MQTT method not supported yet or am I just doing something obviously wrong

2 Likes

I just tried MQTT: !include_dir_merge_named ../entities/mqtt and I still get the same error, I’ve also updated to 2022.6.5

I also don’t see anything in the logs about this as I don’t think it logs YAML checks

Iam running into the same issues. Also tried !include_dir_merge_named but I got errors on that as well.

Some examples in the docs would be nice.

Just a bit more info, I decided to remove the issue of breaking out the configs as a potential issue, so I tried the below in both the mqtt.yaml file and configuration.yaml

MQTT:
  light:
    - name: "Living Room Ceiling Bulb MQTT"
      unique_id: living_room_ceiling_bulb_mqtt
      state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0"
      command_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/command"
      brightness_state_topic: "shellies/shellycolorbulb-E8DB84AA63BE/color/0/status"
      brightness_value_template: "{{ value_json.gain | float | multiply(2.55) | round(0) }}"
      qos: 0
      payload_on: "on"
      payload_off: "off"
      optimistic: false

And I still get the same error every time

The only differences between the tests is when I don’t include it in the packages section it stops referring to it as package MQTT, but the main error of the integration MQTT not being found, I can’t seem to find anything on google (Ironically this thread is the number 1 result lol)

Not sure if this matters, but shouldn’t the mqtt: key be lowercase?

1 Like

OMFG I can’t believe that was it, thank you squire

Thanks, Tom!

I am having an issue and not sure if any one else is with multiple mqtt lights in the new format. This was the closest forum subject i could find.
This passes code check:

mqtt:
  light:
    name: "Home Theater Left Light"

This does not:

mqtt:
  light:
    name: "Home Theater Left Light"
    
  light:
    name: "Home Theater Right Light"

Any ideas how to get the multiple lights going. The old way still works but wanting to upgrade soon.

Thanks!

mqtt:
  light:
    - name: "Home Theater Left Light"
      state_topic: "etc etc"
      command_topic: "etc etc"
    
    - name: "Home Theater Right Light"
      state_topic: "etc etc"
      command_topic: "etc etc"
2 Likes