Persistence for (binary) sensors and switches?

I am still busy creating a complete HA configuration with all the Hue, VeriSure, Netatmo, FitBit, Volvo, Smart Meter, Presence, etc. stuff. So far, it is working quite nice.

One thing that puzzles me is persistence. I’ve search the website and this forum, but I don’t get a clear view on what is (not) supported. So, I’ll just ask…;o)

Does HA provide persistence of sensor and switch states between reboots or other (temporary) disruptions? I read about using InfluxDB but only for writing, not for reading it back as far as I can tell.

I am using mostly MQTT for sensors and switches and an external mqtt broker - mosquitto - even if HA has a good internally mqtt broker. In this way, the mosquitto mqtt broker keep the last state/value for almost all entities (sensors/switches) and they come back after HA restart. Of course, if you define an initial state for something this is it…
However, not all components are in MQTT area, but still possible to bring them there.

https://community.home-assistant.io/t/solved-persistent-switch-even-after-full-reboot-shutdown/291636