But all the light switches, template switches and input_boolean are OFF after restert.
Please suggest, what have i done wrong and what do i need to do to make them restore last state?
By the way - input_number’s are saved and restored correct!
Are you just restarting home assistant or are you restarting the host system?
Assuming he is only restarting home assistant and not the host, it should. Unless these are all mqtt devices. Then it would require the state messages be published as retained messages. So as soon as home assistant connects to the broker state updates are sent.
The recorder has everything to do with this! Otherwise how would home assistant remember the state from before the reboot?
Just adding the recorder is not enough. You would have to add the entities or domains that should be recorded.
Simply the software cannot recognize if some states of your devices have been changed in the middle of restart. This is why it cannot rely on history. It would be bad practice.
Integrations must provide all data again after restart to ensure all states are real.
For example devices based on mqtt integration must be asked for publishing their current states.
because the system writes the states to a file in the .storage folder called “core.restore_state”. I’m pretty sure it doesn’t use the recorder to do that.
I agree; it doesn’t use recorder for that purpose. The entire database can be erased and Home Assistant will still restore entity states on startup because it uses, as you have explained, a completely different source of data (.storage/core.restore_state).
If we’re talking about Template Sensors (Switches, etc), they are evaluated on startup. That’s why a Template Sensor might report unknown or unavailable on startup because one or more entities that it references may not yet be available for use at the moment when the Template Sensor is evaluated.
I checked the documentation for recorder again and you all are right. Sorry for spreading wrong information.
Not sure if this has changed within the last couple of years or I just misinterpreted my observations.