Ability for input_boolean, input_select and input_slider to retain values over a restart

As the title says - I would find this very useful. Currently my heating switches off every time I restart :wink: I can fix that by firing an event after restart but then I have the opposite problem …

3 Likes

That’s weird, at least input_boolean keeps it’s state after a restart for me.

Oh, weird - I’ll check the code and see what is going on then …

Nevermind that, I had an error in my config. Apprently 'off' parses to on. Sorry about the confusion.

No worries - thanks for the clarification!

I’d love to see this added as well.

Yes! I’d like this too. How are people working around this? Is there a way to preserve state across restarts? (New to Home Assistant).

I was running into this and I thought I was doing something wrong… since input_boolean’s “initial” variable is optional, I expected the value to be persistent unless “initial” overrode it.

It still isn’t part of the core functionality but there are a couple of solutions now. I have just written an App for AppDaemon that solves this issue - the release notes are here.

2 Likes

I have made a component that restore the states after a restartt:

4 Likes

Excellent. Thanks for this.

Thanks! I’d like to try this. Can you provide a link to the documentation? How do I install/use this?

+1 for that. Do you just drop it in custom components?

Check my config for example of how to use it.

It will also be an official component: https://github.com/home-assistant/home-assistant/pull/4614

3 Likes

I have tested your code on my home, and I have want to notice to you a little problem with your code.
all is restored at restart but, before restoring stet, my switches toggling. Then my outdoor opened et my cat have an other portion of food…

I have installed the component. Works great. Thank you!

I’m wondering, does this only restore states, or does it restore all other data (is this even kept?) as well, like state_attributes?

Hello, this ability to restore states after restart is something I have been looking for too. I’m a bit confused as I am seeing several different names, like ‘recorder’ and ‘restore_state’.

So I’m just wondering, does this actually work, and is it as simple as putting the name for it into the yaml config file?

Thanks!

Hi there,
sorry to revive an old thread, but haven’t find if today there is a well defined way to keep the status of inputs between restarts, or we still have to resort to custom components like @Danielhiversen

I’d like to keep the state of automations (active/not active) as they are between restarts.

Looking at other recent threads it seems I’m not the only one confused:

Your input_boolean’s should restore their state after restart as long as you don’t set an initial value. As long as I use the default DB, it has worked fine for ages.

1 Like

I can’t believe I was so dumb… :roll_eyes:

I set it up with “initial value” ages ago and completely forgot about it!!! Deleting that made the trick. Thanks @dap35 :+1: