Automation for input select slider / to move back to selected option

Hi all,

I have automation for setting some mqtt topic using input number options via slider. Also sensor for reading topic if selected option has been recieved by mqtt. Automation is as follows:

- id: ebusd38
  alias: Set Backup Mode Hwc
  initial_state: true
    - platform: state
      entity_id: input_number.backup_modehwc
    service: mqtt.publish
      topic: ebusd/ehp/BackupModeHwc/set
      payload: "{{ states.input_number.backup_modehwc.state | float }}"
- id: ebusd39
  alias: Get Backup Mode Hwc
  initial_state: true
    - platform: mqtt
      topic: ebusd/ehp/BackupModeHwc
    service: input_number.set_value
      entity_id: input_number.backup_mode_hwc
      value: "{{ trigger.payload | float }}"

I’m using also other automatins for changing this mqtt topic, so the slider stays in last changed position. I hope you understand. Anyway, I want to make automation that will change slider corresponding to mqtt topic state, no matter if I change it or it is changed on any other way.
Can anyone help me with this? Any examples to share…
Thank you!!!

Isn’t what you’re asking for exactly what your 2nd automation does?
It doesn’t work?