MQTT new format sensor help

I’ve been attempting to adjust my configuration.yaml to match the new requirement and I’m coming up short. I have a few sensors that used to work, but now I can’t see to get the code correct. Any help would be appreciated.

#OLD FORMAT
sensor:
  - platform: template
    sensors: 
      wind_in_mph:
        friendly_name: "Wind Speed"
        unit_of_measurement: "mph"
        value_template: "{{ states('sensor.acurite_5n1_797_ws')|float|round() / 1.6 }}"
 
 #NEW FORMAT
mqtt:
 sensor:
   - state_topic: "wind_in_mph"
     name: "windspeed"
     unit_of_measurement: "mph"
     value_template: "{{ states('sensor.acurite_5n1_797_ws')|float|round() / 1.6 }}"

When I try the above I don’t get an entity called windspeed. Thank you in advance.

I think I’m facing a similar issue? Not sure yet. Still trying to decipher what the config wants from me.

No you aren’t.

Steve has likely put the configuration in the wrong place (needs to be in configuration.yaml).

You used the wrong method to split your config.

Mine is listed in the configuration.yaml file. I now realize I said “config.yaml” in the initial post.

Well, to be honest it was done that way because that’s the way I got it working 1 year back. I read in a forum to do it that way and it worked, so I never new to change it. That being said, your comment did point me in the correct direction and I made the following changes to my configuration.yaml file.

# Template Sensor
template:
  - sensor:
      - name: "wind_in_mph"
        unit_of_measurement: "mph"
        state: "{{ states('sensor.acurite_5n1_797_ws')|float|round() / 1.6 }}"

      - name: "Wind_Direction"
        state: >
          {% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
          {% set degree = states('sensor.acurite_5n1_797_wd')|float %}
            {{ direction[((degree+11.25)/22.5)|int] }}

This worked exactly the way I need it too. Thank you for leading me to the correct path!