Example MQTT Sensor causing error

Hi all,

I’ve been wressling with adding a MQTT Sensor to HA for some time now and I was hoping someone would be able to shed some light on it. Part of the issue is that the examples on the site do not seem to be working…

I checked the instructions on the page : MQTT Sensor - Home Assistant

There is mentioned the “old” way is obsolete and the new method should be used.
When I copy/paste the below example from the page in my configuration.yaml I get the following error

Invalid config for [mqtt]: [sensor] is an invalid option for [mqtt]. Check: mqtt->mqtt->sensor.
    - name: "RSSI"
      state_topic: "home/sensor1/infojson"
      unit_of_measurement: "dBm"
      value_template: "{{ value_json.RSSI }}"
        - topic: "home/sensor1/status"
      payload_available: "online"
      payload_not_available: "offline"
      json_attributes_topic: "home/sensor1/attributes"

If I only use the first example HA accepts the config but I do need a name to use with the sensor, when I add that I get the error again.

    - state_topic: "home/bedroom/temperature"

Am I doing something wrong, or is this change not yet fully implemented in HA

Which version are you using?

The new way of defining MQTT entities applies to Home Assistant version 2022.6.0 (and newer).

I thought I was on the newest version but I’m on 2022.4.7, I recall getting notifications on new versions