SOLVED! MQTT not working as before

Hello,

since i updatet HA to 5.2 all MQTT “sensor” entrys are shown as not present.
But all MQTT “binary.sensor” and “switch” working fine!

mosquitto is installed and i can listen to those missing messages/entrys.

here a part of the configuration.yaml:

mqtt:
 broker: 192.168.2.223

sensor:
 - platform: mqtt
   name: "Solar SERVER Ampere"
   state_topic: "homesys/Solar MPPT/LOAD1 A"
   unit_of_measurement: "A"

 - platform: mqtt
   name: "PI CPU Temp"
   state_topic: "homesys/pi/sys/cpu/temperatur"

these are working:

binary_sensor:
  - platform: mqtt
    name: "IN1"
    state_topic: "homesys/pi/shift_inputs/in1"
    payload_on: "1"
    payload_off: "0"
  - platform: mqtt
    name: "IN2"
    state_topic: "homesys/pi/shift_inputs/in2"
    payload_on: "1"
    payload_off: "0"

Can someone help?

I really don’t see what is wrong. Did you check you still receive messages on those sensors ?

as i said, i can listen to those missing…
but in HA those sensors dont show up

You should not have spaces in MQTT topics.

You don’t have, by any chance, twice

sensor:

in your configuration.yaml ?

but i didnt change anything except update to HA 5.2, with exactly those settings it was running good before…

It might well have done - but it shouldn’t be done.
MQTT Topics, Wildcards, & Best Practices - MQTT Essentials: Part 5.

Maybe it is a bug in 2022.5.2? Try upgrading to 2022.5.4.

You don’t have, by any chance, twice

sensor:

in your configuration.yaml ?

Ohh, that was the error!
Yes, there were two “sensor” in conf…

Thank you, now it works again!

@HA admins/programmers:

Could you please do a better check of configuration.yaml?
With this error i received the message “file is ok” when click on verify conf…

My guess is that the regular / built-in check is probably just to check the structure / syntax - I’m sure other experts could comment/confirm on this.

Either way, I have found that the Studio Code Server add-on works pretty well. I just did a quick and dirty test and got these:
image
image
… and the add-on has saved me a couple of times already.