Input_number and MQTT

Hi,
I want to send the value of a input_number to a ESP32 using the MQTT protocol.
I thought to use an automation that send the value of my slider1 when it change.
How can I configure the trigger’
This is the inpit_number configuration
input_number:
slider1:
name: Temp
initial: 25
min: 0
max: 100
step:1

Try this:

- alias: 'publish slider1'
  trigger:
    - platform: state
      entity_id: input_number.slider1
  action:
    - service: mqtt.publish
      data_template:
        topic: home/slider1
        payload: '{{ trigger.to_state.state }}'
1 Like