How do we use restore_state for input_select and input_slider?

It was added in 0.39, but I don’t know how to configure it.

To my understanding this is automatic. It will grab the latest data from the recorder component and set it to that state.

I just tried moving an input_slider. Restarted HA and it was back at zero.

FYI . According to the blog its supported for input_select and input_boolean. input_slider wasn’t mentioned.

Yup. I also think (not checked) that if you have an initial value for an input_boolean, that will override the state restore

So even if I have initial state setup to the input boolean, it will restore the previous state?

and what if I DO NOT want state to be restored on a particular input Boolean?

@Amir974 I think that’s when you use "initial: " as shown here.

I am using Initial at the moment…
My question is how does initial work with state preservation?

  • Does initial override state preservation or do they work together?
  • What if I want to set initial for a Boolean switch for the first run but from that point on rely on state preservation across restarts? can I do that ?

I would assume you can either have one or the other. Initial will set it on reboot and if you don’t have it, it will use the last saved state.