In 2022.6 release notes, one of the breaking changes changed the way that mqtt devices were defined. It stated that the old way was deprecated, and described a new way to define the mqtt devices. I have made changes to my system using the new way for all the mqtt devices. They are not working. The “check configuration” show valid. I use VS Code to edit the files and it shows “duplicate keys” in the mqtt.yaml file.The devices show up in the entities page, but they are not “active”. For instance, I can click on a switch, but it does not do anything. No “on” or “off”.
Below are parts of the 2 configuration files.
configuration.yaml ---
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#light: !include lights.yaml
binary_sensor: !include binary_sensors.yaml
#switch: !include switches.yaml
group: !include groups.yaml
sensor: !include sensors.yaml
mqtt: !include mqtt.yaml
mqtt.yaml ---
#***********SWITCHES ***********************
switch:
- name: "middle door"
command_topic: "cmnd/middle_door/POWER"
state_topic: "stat/middle_door/status"
qos: 1
switch:
- name: "left door"
command_topic: "cmnd/left_door/POWER"
state_topic: "stat/left_door/status"
qos: 1
switch:
- name: "air compressor"
command_topic: "cmnd/Air_Compressor/power1"
state_topic: "stat/Air_Compressor/RESULT"
qos: 1
switch:
- name: "Motion Sensor_1_433"
state_topic: "tele/RF_Bridge/RESULT"
command_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "5A6AEC"
payload_off: "5A6AECoff"
qos: 1
#*****************LIGHTS*****************
light:
- name: "Breakfast Dimmer"
state_topic: "stat/Breakfast_Dimmer/POWER"
command_topic: "cmnd/Breakfast_Dimmer/POWER"
availability_topic: "tele/Breakfast_Dimmer/LWT"
brightness_state_topic: "stat/Breakfast_Dimmer/RESULT"
brightness_command_topic: "cmnd/Breakfast_Dimmer/Dimmer"
brightness_scale: 100
brightness_value_template: "{{ value_json.Dimmer }}"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
light:
- name: "Floor Dimmer"
state_topic: "stat/Floor_Dimmer/POWER"
command_topic: "cmnd/Floor_Dimmer/POWER"
availability_topic: "tele/Floor_Dimmer/LWT"
brightness_state_topic: "stat/Floor_Dimmer/RESULT"
brightness_command_topic: "cmnd/Floor_Dimmer/Dimmer"
brightness_scale: 100
brightness_value_template: "{{ value_json.Dimmer }}"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
light:
- name: "Den Dimmer"
state_topic: "stat/Den_Dimmer/POWER"
command_topic: "cmnd/Den_Dimmer/POWER"
availability_topic: "tele/Den_Dimmer/LWT"
brightness_state_topic: "stat/Den_Dimmer/RESULT"
brightness_command_topic: "cmnd/Den_Dimmer/Dimmer"
brightness_scale: 100
brightness_value_template: "{{ value_json.Dimmer }}"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
light:
- name: "Back Lights"
state_topic: "stat/Back_Lights/POWER"
command_topic: "cmnd/Back_Lights/POWER"
availability_topic: "tele/Back_Lights/LWT"
brightness_state_topic: "stat/Back_Lights/RESULT"
brightness_command_topic: "cmnd/Back_Lights/Dimmer"
brightness_scale: 100
brightness_value_template: "{{ value_json.Dimmer }}"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false