Input_numbers and problem publishing mqtt

Hello everybody.
I can’t get the values ​​I select with the cursor to publish. Where am I wrong? I’m going crazy…

## configuration.yaml

input_number:
  target_temp:
    name: Temperature
    initial: 26
    min: 18
    max: 30
    step: 1

## automation.yaml

automation:
  - alias: "Temp slider moved"
    trigger:
      platform: state
      entity_id: input_number.target_temp
    action:
      service: mqtt.publish
      data:
        topic: "setTemperature"
        retain: true
        payload: "{{ states('input_number.target_temp') | int }}"

Why are messages not published ???
`

When you look in automation and adjust the temp slider, does it show as triggered? Should flash on top of the trigger with the message “Triggered”

I’m not very experienced … If you mean when I move the cursor to raise or lower the temperature, the temperature value appears above the cursor …

Immagine

I mean in Automations, when you look at it in the GUI editor.
As shown in the blog: 2022.3: Select and play media
triggered

payload_template: "{{ states('input_number.target_temp') | int }}"
          ^^^^^
          |||||

Thanks, with the gui it worked !!!

- id: '1648737530359'
  alias: Temp slider moved
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.target_temp
  action:
  - service: mqtt.publish
    data:
      topic: setTemperature
      payload: "{{ states('input_number.target_temp') | int }}"