How to permanently store helper data?

Thank you very much for Home Assistant, it’s awesome!

I created a helper input_number.wasserzahler_stand_waschmaschine to manually track the water usage of our washing machine. Apparently though, helper data is not stored permanently. I enabled the recorder, but it didn’t change anything.

How can I permanently store helper states?

Helper data only goes back for a week:

also in the database:

❯ sudo sqlite3 -header -column /var/lib/hass/home-assistant_v2.db 'select * from states where entity_id = "input_number.wasserzahler_stand_waschmaschine";'
state_id  entity_id                                      state   attributes  event_id  last_changed  last_updated                old_state_id  attributes_id  context_id                  context_user_id                   context_parent_id  origin_idx
--------  ---------------------------------------------  ------  ----------  --------  ------------  --------------------------  ------------  -------------  --------------------------  --------------------------------  -----------------  ----------
26085133  input_number.wasserzahler_stand_waschmaschine  19.858                                      2022-11-23 07:30:27.550740                33036          01GJHPAB2WZ5QMNJ1PJDY0FPR6  316c416014814e23bc7127e4db1f04a9                     0         
26446403  input_number.wasserzahler_stand_waschmaschine  19.908                                      2022-11-24 07:41:55.572611  26085133      33036          01GJM9C1ZHPWCDVRFQAQNXFWEP  316c416014814e23bc7127e4db1f04a9                     0         
27559721  input_number.wasserzahler_stand_waschmaschine  20.111                                      2022-11-27 08:14:12.029031  26446403      33036          01GJW2DA1TQ71E2E2MEMV2Y6RH  316c416014814e23bc7127e4db1f04a9                     0         
28712667  input_number.wasserzahler_stand_waschmaschine  20.286                                      2022-11-30 08:57:58.916879  27559721      33036          01GK3W3MC2TAK6EX959QFPW9JV  316c416014814e23bc7127e4db1f04a9                     0         

Further info

# Home-assistant core, installed via AUR, running on Raspberry Pi 4 with Manjaro ARM
❯ hass  --version
2022.10.4

recorder integration is enabled:

❯ sudo head -n5 /var/lib/hass/configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:
recorder:

Thanks for any ideas!

You could create a template sensor that tracks the value of the input_number? Not ideal, but if HA cannot record helper values, it’s an option.

1 Like

The recorder component will store your data for the time configured in purge_keep_days.

What you need is the long term statistics that are stored every hour and kept forever. However, states of inputs are not automatically stored there but you can define a sensor that will:

template:
  sensor:
    - name: wasserzahler_stand_waschmaschine
      state: "{{ states(input_number.wasserzahler_stand_waschmaschine) }}"
      unit_of_measurement: "m³"
      state_class: total_increasing
      device_class: water

PS: I am currently checking wheter inputs can be customized into the long-term statitics.
PPS: Nope, it seems only the sensors domain is put there

1 Like

Thank you very much. I applied this config but I wonder where this new sensor should then pop up? I can’t find it under entities or anywhere… 🤷

You might need to change the input’s value before it shows up.

Or I made a mistake with the states function. In that case try

 state: "{{ states.input_number.wasserzahler_stand_waschmaschine.state }}"

You missed the quotes:

state: "{{ states('input_number.wasserzahler_stand_waschmaschine') }}"
------------------^---------------------------------------------^
1 Like

Thanks, all. Unfortunately the purge_keep_days thing and/or the sensor thing causes the map history to vanish for me. Don’t know why but I need that history so back to the beginning… :expressionless:

You can only view that data with a statistics card, not the normal history card.

Okay but how is that related to the map (of locations where everybody is right now). If I set the purge interval, the map history vanishes (no longer see where I have been on the map card).

It’s not related to the map, the map uses the state history, not long term statistics.