Trend keep state, after reboot

Hi there!

I’m running out of cards i think. I simply want to send a notification when a value has increased or decreased. So i wanted to use a Trend. However, when e.g. a value has changed from:

81 to 82, the trend will go to ‘on’. So, that’s nice.

However, when i reboot my HA. The trend is back to ‘off’. But i don’t want that. It should stay on ‘on’. Because when the value will change from 82 to 80. It doesn’t change (because it is already ‘off’).

So simplified:

  • Do something when a value increases from e.g. 80 to 81
  • Rebooting (because of an update e.g).
  • When it decreases from 81 to 79, do something else.

Any ideas how to accomplish this?

Input Boolean’s can save the state between restarts, just don’t set an initial state on the helper when you set it up.

1 Like

You can customise the ‘sample_duration’ of a trend sensor, to force it to look at a longer range of values. Have you tried increasing that?

I haven’t tested myself though to see if it works across a reboot - I imagine it will depend on whether the trend sensor looks at the past X time of states when it evaluates (which would work), or literally ‘stores’ the values as the documentation suggests (which probably would not work).

Otherwise yes, you could use an automation and Input Boolean as Kdem said, to mirror the trend sensor and exclude updates to it after a reboot.