Persistence of state

Your wording is obscure. What do you mean by that?

Just tell me, how I can save state for a D1 Mini flashed with ESPHome?

"if HA is down for a sizeable amount of time, "

Fair but if that is your best rebuttal then I gave up!

Isn’t that your use-case?
Even if we speak seconds and somebody manually switched something in the meantime, the concept is the same.

No :face_vomiting:, but that is the example I quoted to “counter” Tom’s @HA POV.

Are you guys realizing few things - just answer in Y/N?

  1. Do you think that that the best specs or most efficient system wins?
  2. Is HA a geek play or a B2C play? ==> Hint, YOU ARE A B2C PLAY

“Even if we speak seconds and somebody manually switched something in the meantime, the concept is the same.”

That’s the Windows 98 rebuttal when there was no authentication for login for file based permission :grinning:

You are quiet “fair” but “dumb” at the same time…sorry!!

That comes from your OP.

Wins vs who?

Who’s the “B”?

Sorry i miss read your original post, i thought you wanted it in HA not on the esp. i find the examples too lean to make use of esp home, so i use tasmota for everything still.

Either way, i still do something similar for setting the garage position after HA reboots… like after an update. its triggered by the cover position being unknown, then setting it to the reed switch with state on reported in the mqtt message from the garage every teleperiod.

Bottom line:

Please keep asking questions!!!

When I put the HA tablet on screen at the front door, you guys (HA) are competing with b2c brands like Alexa, Apple or Google.

No one in my family cares (besides me) if you are based on SQLLite or InfluxDb or MQTT - the crap (called home automation) just needs to work from their phone…the bar is really that high so please keep your “philosophical” crap to yourself!

Thanks Chris, this is likely the first “consumer friendly” response on this thread!!

There are some possibilities you can use yourself to add persistence of state to a particular sensor.

  • You can copy its value into an input_number or input_boolean with an automation, this input_* value is then kept between restarts.
  • If you use pyscript, it supports the concept of persistent state directly, so your pyscript automations can all create and access persistent state at a very fine granularity.
  • If your sensors use MQTT, then retained messages can bring persistence. HA also publishes two special messages to the broker when it stops and restarts. The latter can be used to update values.
  • If your sensors are DIY, you add a data query function, where HA queries all your sensors for their actual state after restart. That’s probably the best way to go, as you are 100% sure to have up to date values. All my DIY sensors have that. I don’t use ESPHome, so I don’t know if this is supported there.
1 Like

What’s a data query function?

What are these messages and to what topic?
Thanks.

online or offline posted to homeassistant/status. More info here.

A way for the controller (HA) to actively poll the current physical status of a sensor outside of the normal data push operations. This can be done after HA was restarted to get real up to date sensor values. If this is not possible (battery powered sensors) it can be substituted by an external controller (second Pi) that keeps track of the sensor values and resends them on request. MQTT retained message do that, but other ways are possible too.

1 Like