MQTT and configuration.yaml

I am new to Home Assistant and am trying to integrate sensors run on a Raspberry Pi with a HA system based on another RPi using MQTT.

According to MQTT Sensor - Home Assistant, there has been a recent change in configuration.yaml to the format:

Example configuration.yaml entry

mqtt:
sensor:
- state_topic: “home/bedroom/temperature”

However nearly all examples on the web use the earlier ‘platform mqtt’ method.

I have separated out the sensor to sensor.yaml in the form

mqtt:

sensor:

 - name: rpi4 cpu load
   state_topic: "masoko/rpi4/cpuload"
   unit_of_measurement: "%"

 - name: rpi4 cpu temp
   state_topic: "masoko/rpi4/cputemp"
   unit_of_measurement: "°C"

 - ... etc

but Studio Code Server says 'Missing property “Platform” ’ against the mqtt: line.

I am assuming that I am using mismatched Home Assistant ( Home Assistant 2022.8.6 Supervisor 2022.08.3 Operating System 8.5 Frontend 20220802.0 - latest ) and Studio Code Server.

What should I do?

Use the documentation for HA and then only use the HA code validation checker and not the VSC checker.

VSC isn’t HA version specific because the author needs to update the checker when there is a new HA version. and there are bugs with that already reported for a long time now.

the HA code validation tool will (should…) be up to date with HA.