Entity display value but now save to DB

Hello.

I’d like reduce my DB (now more than 5 GB) and I wondering (because not found in documentation) there is possibility to set storage type to cache only of entity and parallel not save to DB state?

So for example I have entity:

sensor.data_not_important_to_save_to_db_but_nice_to_display

where data arrive from some source (eg. from MQTT integration) and I want to see value of the entity only from last update and keep state in cache memory only, no save into DB (in DB keep only definition of DB to have it after restart DB). If I have fresh restarted HA then cache storage type entity will have unavailable status until receive data from source.

Is possible achieve it in HA?

BR, Krzysiek

No that is not possible.

Thank you for answer, then I will try create feature request, maybe someone from developers will look on it…

You can exclude entities from being stored with the recorder integration,
for example:

recorder:
  exclude:
    entities:
      - sensor.some_sensor

see Recorder - Home Assistant for details

But I think the is no “cache memory”, either you do store states and attributes with the recorder or you don’t to that, for the latter you only have the current state and can’t display previous states.

The idea is keep current data (no history at all for the entity). In recorder I can disable it but the entity will be displayed? Not yest read documentation of recorder hence question

I’m not sure, I think you’ll see no history, neither from database nor any past values from memory since the latest HA restart. But the latest state should be available.

Armin

Yes, but working and not working :slight_smile:

For test take one entity ~8h ago:

recorder:
  exclude:
    entities:
      - sensor.cwu_4_historical_total_m3

And history showing me this:

Additional purge the entity:

and SQL metadata of the entity has been deleted (the SQL result is another entity):

but still see the data in history, not understood this…

PS. Found some information for developers

Reading this check attributes and I have:

and linked material speak about:

Using the MATCH_ALL constant does not stop recording for device_class , state_class , unit_of_measurement , and friendly_name as they might also serve other purposes and, therefore, should not be excluded from recording.

and I have all of theme.