twrecked / hass-virtual

Virtual Components for Home Assistant
GNU General Public License v3.0
167 stars 28 forks source link

Add optional persistence against hass restart to sensors. #42

Closed SergeyPomelov closed 1 year ago

SergeyPomelov commented 1 year ago

Added "persistent" bool property to sensors.

It's false (does nothing) by default. If set to true, an implementation of RestoreEntity restores a pre-restart state.

Quite useful for me with the virtuals for custom sensors which are only pushing not critical data to hass, instead existing hacks, mqtt persistence, etc. You might notice a lot of debate/threads begging to include this option in hass core. Virtual + this feature feels like a decent general solution for now.

What do you think?

twrecked commented 1 year ago

This is great. I've been short on time recently so thanks for doing this.

I'm just playing with it now, I'll merge it over later today.