Number not updating on slider

I have this to control a servo:

  - platform: template
    name: Subwoofere
    min_value: -100
    max_value: 100
    step: 1
    set_action:
      then:
        - servo.write:
            id: sub
            level: !lambda 'return x / 100.0;'

When I move the slider, the servo moves as expected, but the number in “State” in the UI is still at -100. I need to read this to see how far the servo has come, so I can for instance change position from 100 to 90. Why isn’t this working?

Try to use optimistic: true as described:

  • optimistic (Optional, boolean): Whether to operate in optimistic mode - when in this mode, any command sent to the template number will immediately update the reported state. Cannot be used with lambda. Defaults to false.
1 Like

Thanks, that worked!