Can't get MQTT to work since last update

Hi,

I have a few MQTT switches, sensors, and lights that stopped working after updating to HA 2022.9.0. I read through the release/change notes and made (what I thought) were the necessary modifications to my configuration.yaml and added a mqtt.yaml file.

In my configuration.yaml file I have a line reading:

mqtt: !include mqtt.yaml

in my mqtt.yaml file I have the following entries after formatting the items slightly (all passed configuration.yaml check in developer):

switch:
  - name: "Man Cave Fan"
    state_topic: "tele/Man_Cave_Fan/STATE"
    command_topic: "cmnd/Man_Cave_Fan/POWER"
    availability:
      - topic: "tele/Man_Cave_Fan/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    qos: 0
    retain: true

light: 
  - name: "Aprils Lamp"
    command_topic: "cmnd/Aprils_Lamp/POWER"
    state_topic: "tele/Aprils_Lamp/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/Aprils_Lamp/LWT"
    brightness_command_topic: "cmnd/Aprils_Lamp/Dimmer"
    brightness_state_topic: "tele/Aprils_Lamp/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/Aprils_Lamp/STATE"
    white_value_command_topic: "cmnd/Aprils_Lamp/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/Aprils_Lamp/Color2"
    rgb_state_topic: "tele/Aprils_Lamp/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/Aprils_Lamp/Scheme"
    effect_state_topic: "tele/Aprils_Lamp/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false
  
light:
  - name: "CR-10 Lamp"
    command_topic: "cmnd/cr10light/POWER"
    state_topic: "tele/cr10light/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/cr10light/LWT"
    brightness_command_topic: "cmnd/cr10light/Dimmer"
    brightness_state_topic: "tele/cr10light/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/cr10light/STATE"
    white_value_command_topic: "cmnd/cr10light/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/cr10light/Color2"
    rgb_state_topic: "tele/cr10light/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/cr10light/Scheme"
    effect_state_topic: "tele/cr10light/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false
  
light:
  - name: "Man Cave Light 1"
    command_topic: "cmnd/mancavelight1/POWER"
    state_topic: "tele/mancavelight1/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/mancavelight1/LWT"
    brightness_command_topic: "cmnd/mancavelight1/Dimmer"
    brightness_state_topic: "tele/mancavelight1/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/mancavelight1/STATE"
    white_value_command_topic: "cmnd/mancavelight1/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/mancavelight1/Color2"
    rgb_state_topic: "tele/mancavelight1/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/mancavelight1/Scheme"
    effect_state_topic: "tele/mancavelight1/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false
  
light:
  - name: "Man Cave Light 2"
    command_topic: "cmnd/mancavelight2/POWER"
    state_topic: "tele/mancavelight2/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/mancavelight2/LWT"
    brightness_command_topic: "cmnd/mancavelight2/Dimmer"
    brightness_state_topic: "tele/mancavelight2/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/mancavelight2/STATE"
    white_value_command_topic: "cmnd/mancavelight2/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/mancavelight2/Color2"
    rgb_state_topic: "tele/mancavelight2/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/mancavelight2/Scheme"
    effect_state_topic: "tele/mancavelight2/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false
  
light:
  - name: "Xanders Light Strip"
    command_topic: "cmnd/xanderlightstrip/POWER"
    state_topic: "tele/xanderlightstrip/STATE"
    state_value_template: "{{value_json.POWER}}"
    availability_topic: "tele/xanderlightstrip/LWT"
    brightness_command_topic: "cmnd/xanderlightstrip/Dimmer"
    brightness_state_topic: "tele/xanderlightstrip/STATE"
    brightness_scale: 100
    on_command_type: "brightness"
    brightness_value_template: "{{value_json.Dimmer}}"
    white_value_state_topic: "tele/xanderlightstrip/STATE"
    white_value_command_topic: "cmnd/xanderlightstrip/White"
    white_value_scale: 100
    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/xanderlightstrip/Color2"
    rgb_state_topic: "tele/xanderlightstrip/STATE"
    rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
    effect_command_topic: "cmnd/xanderlightstrip/Scheme"
    effect_state_topic: "tele/xanderlightstrip/STATE"
    effect_value_template: "{{value_json.Scheme}}"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    retain: false
  
light:
  - name: "Man Cave Lamp 2"
    state_topic: "stat/Man_Cave_Lamp_2/POWER"
    command_topic: "cmnd/Man_Cave_Lamp_2/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
  
light:
  - name: "Deck Lights"
    state_topic: "stat/Outdoor_Lights/POWER"
    command_topic: "cmnd/Outdoor_Lights/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
 
light:
  - name: "Living Room Lamp 1"
    state_topic: "stat/merkury1/POWER"
    command_topic: "cmnd/merkury1/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

light:
  - name: "Living Room Lamp 2"
    state_topic: "stat/merkury2/POWER"
    command_topic: "cmnd/merkury2/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

sensor:
  - name: 'Basement Temperature'
    state_topic: "/BasementClimate/BasementClimate/Temperature"
    unit_of_measurement: Ā°C
#    value_template: '{{ value_json.Temperature }}'
    qos: 0
#    retain: true

sensor:
  - name: 'Basement Humidity'
    state_topic: "/BasementClimate/BasementClimate/Humidity"
    unit_of_measurement: '%'
#    value_template: '{{ value_json.Humidity }}'
    qos: 0
#    retain: true

sensor: 
  - name: 'Basement Sensor Uptime'
    state_topic: "/BasementClimate/Uptime/Uptime"
    unit_of_measurement: 'minutes'
    qos: 0
#    retain: true

sensor: 
  - name: "Outdoor Temperature"
    state_topic: "tele/Outdoor_Lights/SENSOR"
    value_template: "{{ value_json.AM2301.Temperature }}"
    unit_of_measurement: "Ā°C"

sensor:
  - name: "Outdoor Humidity"
    state_topic: "tele/Outdoor_Lights/SENSOR"
    value_template: "{{ value_json.AM2301.Humidity }}"
    unit_of_measurement: "%"

The only item that appears to be working is the first switch that is a fan; that works fine. The other lights , and sensors donā€™t register. What am I doing so wrong?

I assume this is a typo - and it really says:

availability_topic: "tele/Man_Cave_Fan/LWT"

?

Nope; not a typo. Thatā€™s the configuration example given from the MQTT switch page.

mqtt:
  switch:
    - unique_id: bedroom_switch
      name: "Bedroom Switch"
      state_topic: "home/bedroom/switch1"
      command_topic: "home/bedroom/switch1/set"
      availability:
        - topic: "home/bedroom/switch1/available"
      payload_on: "ON"
      payload_off: "OFF"
      state_on: "ON"
      state_off: "OFF"
      optimistic: false
      qos: 0
      retain: true

I see that is an example given, but as you arenā€™t using any of the options in the availability key, I donā€™t see the point in using it.

Anyway the next thing I see -

I donā€™t see:

white_value_state_topic:
white_value_template:

options in the default schema.

Getting closer. Apparently I had some major yaml errors. Should only have one light:, Sensor:, and switch: line per each set. The lights are the last bit that arenā€™t working and thatā€™s probably due to how the white_value part has change and I havenā€™t quite got that part figured out yet.

Here is my current mqtt.yaml file.

switch:
  - unique_id: man_cave_fan
    name: "Man Cave Fan"
    state_topic: "tele/Man_Cave_Fan/STATE"
    command_topic: "cmnd/Man_Cave_Fan/POWER"
 #   availability_topic: "tele/Man_Cave_Fan/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    qos: 0
    retain: true
    
  - unique_id: man_cave_lamp_2
    name: "Man Cave Lamp 2"
    state_topic: "stat/Man_Cave_Lamp_2/POWER"
    command_topic: "cmnd/Man_Cave_Lamp_2/POWER"
#    availability_topic: "tele/Man_Cave_Lamp_2/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
  
  - unique_id: deck_lights
    name: "Deck Lights"
    state_topic: "stat/Outdoor_Lights/POWER"
    command_topic: "cmnd/Outdoor_Lights/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
 
  - unique_id: living_room_lamp_1
    name: "Living Room Lamp 1"
    state_topic: "stat/merkury1/POWER"
    command_topic: "cmnd/merkury1/POWER"
    availability_topic: "tele/merkury1/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

  - unique_id: living_room_lamp_2
    name: "Living Room Lamp 2"
    state_topic: "stat/merkury2/POWER"
    command_topic: "cmnd/merkury2/POWER"
    availability_topic: "tele/merkury2/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

light: 
  - name: aprils_lamp
    schema: json
    command_topic: "cmnd/Aprils_Lamp/POWER"
    state_topic: "tele/Aprils_Lamp/STATE"
    brightness: true
    color_mode: true
    supported_color_modes: ["rgbw"]
    qos: 1
    retain: false
  
  - name: "cr10_lamp"
    schema: json
    command_topic: "cmnd/cr10light/POWER"
    state_topic: "tele/cr10light/STATE"
    brightness: true
    color_mode: true
    supported_color_modes: ["rgbw"]
    qos: 1
    retain: false   
  
  - name: "man_cave_light_1"
    schema: json
    command_topic: "cmnd/mancavelight1/POWER"
    state_topic: "tele/mancavelight1/STATE"
    brightness: true
    color_mode: true
    supported_color_modes: ["rgbw"]
    qos: 1
    retain: false 
  
  - name: "man_cave_light_2"
    schema: json
    command_topic: "cmnd/mancavelight2/POWER"
    state_topic: "tele/mancavelight2/STATE"
    brightness: true
    color_mode: true
    supported_color_modes: ["rgbw"]
    qos: 1
    retain: false 
  
sensor:
  - name: 'Basement Temperature'
    state_topic: "/BasementClimate/BasementClimate/Temperature"
    unit_of_measurement: Ā°C
#    value_template: '{{ value_json.Temperature }}'
    qos: 0
#    retain: true

  - name: 'Basement Humidity'
    state_topic: "/BasementClimate/BasementClimate/Humidity"
    unit_of_measurement: '%'
#    value_template: '{{ value_json.Humidity }}'
    qos: 0
#    retain: true
 
  - name: 'Basement Sensor Uptime'
    state_topic: "/BasementClimate/Uptime/Uptime"
    unit_of_measurement: 'minutes'
    qos: 0
#    retain: true

  - name: "Outdoor Temperature"
    state_topic: "tele/Outdoor_Lights/SENSOR"
    value_template: "{{ value_json.AM2301.Temperature }}"
    unit_of_measurement: "Ā°C"

  - name: "Outdoor Humidity"
    state_topic: "tele/Outdoor_Lights/SENSOR"
    value_template: "{{ value_json.AM2301.Humidity }}"
    unit_of_measurement: "%"

Can we just check double check these topics - because there are a few issues that immediately jump out -

  1. Topics generally should not start with / because what that really means behind the scenes is <empty>/ it will still work but it should be avoided.
  2. /BasementClimate/BasementClimate/ is this definitely correct? If so why does humidity and temperature both have this weird pattern of topic - and then uptime - instead of using BasementClimate twice, instead uses it once and then has uptime twice? /BasementClimate/Uptime/Uptime

Since you are migrating - you might as well add unique_id to all the entities that are missing it in this file, if it helps, I just use https://www.uuidgenerator.net/ to generate a UUID and then refresh the page to get a new UUID for the next entity.

Can you list what is actually working from your file and what is not, to make it easier to spot the issue.

The /BasementClimate/BasementClimate, etc is correct and is one of the sensors working and reporting data correctly with that setup.

WRT my mqtt.yaml file, the parts that arenā€™t working are aprils_lamp, cr10_lamp, man_cave_light_1, and man_cave_light_2. These are all RGBW tuya bulbs that were flashed with Tasmota some time ago.

This was the config for the lights before 2022.9.0 came out that worked.

- platform: mqtt
  name: "Aprils Lamp"
  command_topic: "cmnd/Aprils_Lamp/POWER"
  state_topic: "tele/Aprils_Lamp/STATE"
  state_value_template: "{{value_json.POWER}}"
  availability_topic: "tele/Aprils_Lamp/LWT"
  brightness_command_topic: "cmnd/Aprils_Lamp/Dimmer"
  brightness_state_topic: "tele/Aprils_Lamp/STATE"
  brightness_scale: 100
  on_command_type: "brightness"
  brightness_value_template: "{{value_json.Dimmer}}"
  white_value_state_topic: "tele/Aprils_Lamp/STATE"
  white_value_command_topic: "cmnd/Aprils_Lamp/White"
  white_value_scale: 100
  white_value_template: "{{ value_json.Channel[3] }}"
  rgb_command_topic: "cmnd/Aprils_Lamp/Color2"
  rgb_state_topic: "tele/Aprils_Lamp/STATE"
  rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
  effect_command_topic: "cmnd/Aprils_Lamp/Scheme"
  effect_state_topic: "tele/Aprils_Lamp/STATE"
  effect_value_template: "{{value_json.Scheme}}"
  effect_list:
    - 0
    - 1
    - 2
    - 3
    - 4
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  qos: 1
  retain: false
  
- platform: mqtt
  name: "CR-10 Lamp"
  command_topic: "cmnd/cr10light/POWER"
  state_topic: "tele/cr10light/STATE"
  state_value_template: "{{value_json.POWER}}"
  availability_topic: "tele/cr10light/LWT"
  brightness_command_topic: "cmnd/cr10light/Dimmer"
  brightness_state_topic: "tele/cr10light/STATE"
  brightness_scale: 100
  on_command_type: "brightness"
  brightness_value_template: "{{value_json.Dimmer}}"
  white_value_state_topic: "tele/cr10light/STATE"
  white_value_command_topic: "cmnd/cr10light/White"
  white_value_scale: 100
  white_value_template: "{{ value_json.Channel[3] }}"
  rgb_command_topic: "cmnd/cr10light/Color2"
  rgb_state_topic: "tele/cr10light/STATE"
  rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
  effect_command_topic: "cmnd/cr10light/Scheme"
  effect_state_topic: "tele/cr10light/STATE"
  effect_value_template: "{{value_json.Scheme}}"
  effect_list:
    - 0
    - 1
    - 2
    - 3
    - 4
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  qos: 1
  retain: false
  
- platform: mqtt
  name: "Man Cave Light 1"
  command_topic: "cmnd/mancavelight1/POWER"
  state_topic: "tele/mancavelight1/STATE"
  state_value_template: "{{value_json.POWER}}"
  availability_topic: "tele/mancavelight1/LWT"
  brightness_command_topic: "cmnd/mancavelight1/Dimmer"
  brightness_state_topic: "tele/mancavelight1/STATE"
  brightness_scale: 100
  on_command_type: "brightness"
  brightness_value_template: "{{value_json.Dimmer}}"
  white_value_state_topic: "tele/mancavelight1/STATE"
  white_value_command_topic: "cmnd/mancavelight1/White"
  white_value_scale: 100
  white_value_template: "{{ value_json.Channel[3] }}"
  rgb_command_topic: "cmnd/mancavelight1/Color2"
  rgb_state_topic: "tele/mancavelight1/STATE"
  rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
  effect_command_topic: "cmnd/mancavelight1/Scheme"
  effect_state_topic: "tele/mancavelight1/STATE"
  effect_value_template: "{{value_json.Scheme}}"
  effect_list:
    - 0
    - 1
    - 2
    - 3
    - 4
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  qos: 1
  retain: false
  
- platform: mqtt
  name: "Man Cave Light 2"
  command_topic: "cmnd/mancavelight2/POWER"
  state_topic: "tele/mancavelight2/STATE"
  state_value_template: "{{value_json.POWER}}"
  availability_topic: "tele/mancavelight2/LWT"
  brightness_command_topic: "cmnd/mancavelight2/Dimmer"
  brightness_state_topic: "tele/mancavelight2/STATE"
  brightness_scale: 100
  on_command_type: "brightness"
  brightness_value_template: "{{value_json.Dimmer}}"
  white_value_state_topic: "tele/mancavelight2/STATE"
  white_value_command_topic: "cmnd/mancavelight2/White"
  white_value_scale: 100
  white_value_template: "{{ value_json.Channel[3] }}"
  rgb_command_topic: "cmnd/mancavelight2/Color2"
  rgb_state_topic: "tele/mancavelight2/STATE"
  rgb_value_template: "{{value_json.Color.split(',')[0:3]|join(',')}}"
  effect_command_topic: "cmnd/mancavelight2/Scheme"
  effect_state_topic: "tele/mancavelight2/STATE"
  effect_value_template: "{{value_json.Scheme}}"
  effect_list:
    - 0
    - 1
    - 2
    - 3
    - 4
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  qos: 1
  retain: false

It looks like you want to be using the schema: template rather than schema: json. See further down the page for examples:

Looking at Tasmota docs -

mqtt:
  light:
    - name: "RGB Light"
      command_topic: "cmnd/tasmota/POWER"
      state_topic: "tele/tasmota/STATE"
      state_value_template: "{{ value_json.POWER }}"
      availability_topic: "tele/tasmota/LWT"
      brightness_command_topic: "cmnd/tasmota/Dimmer"
      brightness_state_topic: "tele/tasmota/STATE"
      brightness_scale: 100
      on_command_type: "brightness"
      brightness_value_template: "{{ value_json.Dimmer }}"
      rgb_command_topic: "cmnd/tasmota/Color2"
      rgb_state_topic: "tele/tasmota/STATE"
      rgb_value_template: "{{ value_json.Color.split(',')[0:3]|join(',') }}"
      effect_command_topic: "cmnd/tasmota/Scheme"
      effect_state_topic: "tele/tasmota/STATE"
      effect_value_template: "{{ value_json.Scheme }}"
      effect_list:
        - 0
        - 1
        - 2
        - 3
        - 4
      payload_on: "ON"
      payload_off: "OFF"
      payload_available: "Online"
      payload_not_available: "Offline"

See here: Home Assistant - Tasmota in case this still isnā€™t right - this is all the information they have for the lights. Note they still have the white_value stuff in there so just ignore those parts.

You are right. This got confusing real fast.

Iā€™ve posted a bit of an update over here to my situation. Still having issues getting these specific Merkury bulbs to work correctly.

1 Like

Changes are not only breaking our configuration but also our heart too. Should have been simpler. why not implementing backward compatible solutions. better yet some kind of conversion tool. care for us dear valuable software authors. Thanks million any way.