Manual MQTT sensors

I used to have several manual MQTT sensors set up in my config, but they stopped working with the following

[homeassistant.components.sensor] The mqtt platform for the sensor integration does not support platform setup. Please remove it from your config.

I have MQTT integration added and it auto discovers my zwave2mqtt sensors fine but I cannot get it to auto discover the following. I keep seeing people say add to my sensors config, but it no longer works. Any idea please? My published topic, which works as mqtt explorerer picks it up.

        "topic": "homeassistant/sensor/cumulus/state",
        "data": "{\"time\":\"<#timehhmmss>\",\"temp\":<#temp rc=y>,\"humidity\":<#hum>,\"rainyear\":<#ryear>,\"rain rate\":<#rrate>,\"pressure\":<#press>,\"windspeed\":<#wspeed>,\"windgust\":<#wgust rc=y>}",
        "retain": false
  - platform: mqtt
    name: "Temp"
    state_topic: "homeassistant/sensor/cumulus/state"
    value_template: '{{ value_json["temp"] }}' 
    unit_of_measurement: "°C" 

You must be reading old documentation. Structure is different now:

This changed in 2022: see the first Backward-Incompatible Changes entry in the 2022.6 release notes:

    - name: "Temp"
      state_topic: "homeassistant/sensor/cumulus/state"
      value_template: "{{ value_json['temp'] }}"
      unit_of_measurement: "°C"
      device_class: temperature
1 Like

Thank you! I haven’t used these in ages as I was using a different method. I was using old documents! Appreciate it