Can't get MQTT Swittches to be added!

Hi there,

With the deprecation of the old MQTT configurations coming in 2022.12 I’m left with one type of device that will just not want to add itself to the configuration. Switches…

I’m trying to add mqtt: → switch: → switches to my configuration using different merges. The first is including a mqtt include file in my main configuration.
From this “overall.yaml” file i’m adding all the different mqtt types such as covers, binsensors, sensors and trying to add "switch:’ now as well. But this last one keeps giving issues when adding it.

When adding “switch: !include_dir_merge_list mqttswitches/” it gives the error image ‘NodeListClass’ object has no attribue ‘get’

It doesn’t matter if there are files with configurations in the folder mqttswitches or not. It will always give the error as soon as that line exists.

Example of a switch file:

Can someone guide me in the right direction so I can get the switches working again?

Thanks!

I have kind of the same problem. When I add this to my configuration.yaml home assistant starts flipping and when I try restarting hom assistant core crashes until I remove the mqtt-switch from my configuration.yaml

mqtt:
  switch:
    - unique_id: Knop_Inkom
      name: "Knop_Inkom"
      state_topic: "shellies/shelly4pro-CC8B9E/relay/0"
      command_topic: "shellies/shelly4pro-CC8B9E/relay/0/command"
      payload_on: "ON"
      payload_off: "OFF"
      state_on: "ON"
      state_off: "OFF"
      optimistic: false
      qos: 0
      retain: true

I have the same problem. Did you find a solution?

No I haven’t found a solution yet, I’m using the shelly integration right now. But I want to have it all based on mqtt and there are other switches which only allow mqtt and now aren’t working.

I’ve solved my issue. It was because another switch was defined in a package from a vendor without a - before switch so =
mqtt

  • sensor
    switch
    I corrected that and it worked fine.

After your comment I found my issue as well, I had a package which defined a switch as well without the symbol for the list. Thanks!

1 Like

I need help with this too. I woke up today with a perfectly working MQTT setup. I had been delaying the update past the changes in the MQTT arrangement for this reason, but today I decided to update.

I was on a 2022 version of HA and everything was working great.

Now I can’t get a single one of my Shelly switches to register via MQTT

I have tried the arrangement above, and lots of other things, including the autodiscovery plugins.

Can someone show a working MQTT setup for a shelly 2.5 please?

thanks

After twelve hours of work, I have found that the configuration above works, if I change the uppercase ON and OFF to lowercase on and off.

Makes sense. :\