Running total from history stat sensor

Hi all,

Haven’t had much luck in figuring this out so looking for some ideas on how I can take a daily value from a history stat sensor (hours counted during the day that my house is off grid with solar) which resets each night and add it to a running total.

and no i don’t want to extend the history stats purge, I just want to keep track of this one value long term.


Time trigger at 23:59

      - service: input_text.set_value
          value: "{{ states('sensor.history') | float + states('')| float }}"

I choose text since it it only limited at 255 characters, where as a number might be limited at some specific size.

Hi Hellis81 - I did see some of your responses in this thread. Wasn’t having any luck getting the automation to work, perhaps I’ll try with text and see if that helps.

EDIT: Got it working! I also just updated to latest HA, so between that and and text helper has solved it.

Depending on what the value is you have in your history sensor then it may need some more tweaking?
Is your sensor in minutes or hours or what is it?