Input_boolean doesn't restore state after HA restart

To my understanding all the input_boolean, input_datetime, input_number, input_select and input_text are able to survive HA restart, as HA save the states into core.restore_state file every 15 minutes and just before restart or shutdown.

I noticed mine doesn’t restore the state after reboot, I found out it do the every 15 min save, but not restart/shutdown.

Anyone experiencing the same problem ?

so I create a bunch of test entity without initial value and a test tab on lovelace for me input all the value. At the same time open up two terminal windows to monitor the /.storage folder and the content of the core.restore_state file. I can see the file update the value every 15 minutes. but whenever I restart HA, it’s a hit or miss situation, sometime it update, sometime it doesn’t. It’s just so random I can’t figure out what may be causing it.


    has_time: true
    has_date: true

    min: 1
    max: 50

    - One
    - Two

  - title: Test 
    - type: entities
      show_header_toggle: false
      - input_boolean.test_saving
      - input_datetime.test_saving
      - input_number.test_saving
      - input_select.test_saving
      - input_text.test_saving

Did you file an issue on github ?

Yes, I did.
I assume a lot of people uses input_* component, but I didn’t see anyone mention they having problem. Am I the only one ? Does yours causing any problem with HA restart ?

post the link to the issue so I can add my :+1:

Does it update when you change its state?

I don’t have an issue with input boolean restore on restart.


The file core.restore_state only get update every 15 minutes and just before restart or shutdown.
If I left HA running, I can see the file get update every 15 minutes perfectly. and a pair of log always show up

DEBUG (MainThread) [homeassistant.helpers.restore_state] Dumping states
DEBUG (SyncWorker_0) [] Writing data for core.restore_state

but when I do a system restart, almost 9 out of 10 times I’ll only have the Dumping States line only, and won’t see the Writing data for core.restore_state

I believe I found the root cause of the problem I’m encountering.
A Visual Studio Code browser tab causing the system not to do the last save states just before HA restart.

I always have at least 2 tab open, 1 tab is the HA overview, and 1 tab is always the VScode and I pretty much always have the VScode active and never close or switch that tab away from VScode. As such. the last state save was not perform upon HA restart. If I close that VScode tab, everything work as expected. core.restore_state get updated, thus input_* state got load back upon startup.

I suppose most people use 1 tab to switch between Configuration, VScode, Overview…etc thus this problem rarely show up.

I had gone as far as creating a brand new instance of Hassio from scratch and only install Visual Studio Code Add-on. Using the default plain jane configuraiton.yaml and add input_text entity in there to perform my test. I believe by doing so I should have ruled out all configuration, integration and add-on influences.

if anyone stumble upon this thread and having trouble with entity states suppose to survive restart but didn’t AND you’re using Visual Studio Code v2.4.0 try closing the VScode tab before restart and see if it helps. this happen to me on HA 0.111.7 to 0.112.4 to 0,113.0, 0,113.1, 0.113.2 and 0.113.3

Interesting. I often leave a window with the vscode addon open when restarting and have not noticed this issue.

Me either. Majority of my input_* have initial value and I accepted the fact from the old days that if one should restart HA, state won’t be saved. So I never pay attention to this.

Not until I found the code that made timer resume upon restart, which require input_text to get it working. I want it so badly, and it doesn’t work on my HA, and found no post regarding broken input_* so I knew it’s either my own HA installation problem, or it’s some super duper rare case and I’m on my own to troubleshoot. I kept doubting my finding until I start a install-from-scratch-bare-HA installation earlier today, which I can’t blame anything else anymore because this is rock bottom bare installation.

I’m still open to suggestion because I love using VScode. Closing the tab + restart + Re-opening Vscode will eventually become annoying.

Are you using the VSCode addon?

To test this I just did the following:

  • I started the VSCode addon and opened a couple of files (configuration.yaml, automations.yaml)
  • Opened Home assistant in another tab (firefox browser).
  • Did a configuration check just to be on the safe side.
  • Toggled one of my input booleans to ‘on’
  • Immediately restarted home assistant
  • After restarting I found that my toggled input boolean was ‘on’ as expected.

Thank you Tom for testing ! Yes, I’m using VSCode addon

This is quite interesting, I’m out of clue as to what else I can strip down in my test environment.

  • it’s a new VM, using supervised HA, so Linux OS already did the update & upgrade
  • bare bone configuration.yaml, just added input_text
  • did not configure any detected integration
  • VScode add-on only
  • accessing HA via internal IP only, so no SSL, no proxy, no router firewall, no port forward to consider
  • accessing VScode via HA sidebar

In my test environment, this is my current configuration.yaml (total 3 lines)


@tom_l how do you restart your HA ?

I went through Configuration > Server Controls > Server Management > Restart

Same way.

Spent sometime on testing this, setup a brand new instance of HassOS using official vmdk file, no integration setup, only added VScode addon, the configuration,yaml only have 3 lines.


If I have the VScode open on a browser tab, the input_text won’t be save upon restart.
If I close VScode tab, the input_text will save and survive reboot.

Made a video

NodeRed is doing the same thing.

I opened an issue for this back on 6/15. 2 months and only a few replies from others having the same issue. I’m not using the vscode addon. I can see the core.restore_state file update with the correct value then a few seconds later, it updates again with unknown. I’m temporarily working about it by storing the values in mqtt with retain = true. Not the best way to do things but when I’m restarting ha multiple times while testing and setting up new things, I was losing state values constantly.

It maybe ingress related as Paul Sinclair pointed out here. If I don’t open any extra HA tab, just use one browser tab to edit, view and restart, everything works fine and that’s my work around now, the reboot is like 4~5 times faster. Give that a try and see if it helps.

I’m having issues the core.restore_states file never updates during restart only every 15 minutes.

So if something changes then restart quite quickly the state’s change back on start.