Repost? Am I using history and recorder wrong?

Apologies if anyone sees this as a duplicate post. Every time I went to “my posts” this was always a draft that I couldn’t get to post.

Am I using history and recorder wrong?

The history graph card mostly always shows “No state history found”. But when I open the card page, it starts accumulating data for the graph.

But as soon as I leave that page and open it again, the data is gone.
5 minutes later:

freezer no chart

Here is my recorder code from my configuration.yaml:

#---------- Recorder ----------#
recorder:
  auto_purge: true #default: true

  # Keep all entity history for 90 days
  purge_keep_days: 90
  
  # Customize retention period for specific entities
  include:
      entities:
        - sensor.dexcom_stevermann_glucose_value
        - sensor.freezer_temperature_c
        - sensor.xiaomi_mi_1_temperature_celsius
      
  # Exclude specific entities from history recording
  exclude:
    entities:
      - sensor.date
    domains:
      - sensor
      - switch
    entity_globs:
      - sensor.sun*
      - weather.*

The glucose_value is working, but neither the freezer nor the refrigerator sensors are collecting any data.

Here is the code from my card that should show the history of the freezer temperatures:

    - type: history-graph
      entities:
        - entity: sensor.freezer_temperature_c
      hours_to_show: 6
      refresh_interval: 10
      title: Freezer Temperature

Any ideas would be appreciated.

Yes it is a repost. See:

Strange, even the post you linked to says that its’ a draft.

Looks ok from this end. Try clearing your web browser cache.

No good. This is usually the first thing I try. Besides, what’s that got to do with the data in the history database?

In my configuration.yaml, I want the glucose data for 90-days. I would like the temperature history for a month, but I don’t see any way to separate them. But 90 days is OK there, too.

If I take out the include and exclude, the database grows to over 6gb in just a few days.

What I am getting is, NO saved data for the temperature sensors and only 12-days for the glucose data.

That’s why I am asking if I am using the recorder tool wrong?

No, you are using it as per the documentation. Domain excludes to exclude everything in the domain and entity includes to only include those entities.

However… when writing this I recommended only using includes or excludes. Not both, as I found i could not get the documented logic to work. That post has now been edited away (28 wiki edits) but it was there. Issues were opened and the integration has been updated many times since then but my advice is still the same. The documented logic does not work. Only use includes or excludes.

In your case, just use this and see what happens.

  include:
      entities:
        - sensor.dexcom_stevermann_glucose_value
        - sensor.freezer_temperature_c
        - sensor.xiaomi_mi_1_temperature_celsius

It will exclude everything else.

You can add more includes later as you need after running this test.

Also do you have history: or default_config: in your configuration.yaml file?

Thanks. I’ll try it without all the exclude lines.
And, yes, default_config is on line two of my configurations file.

Your recorder settings can be OK.
Check this freshly created helper:

image

It has no history - because it is just created.
Start playing with a slider:

Close more info & open again:

image

This is expected since all “test_*” helpers are excluded in my config.
Start playing again:

So, even a not-recorded entity may be shown in more-info or in History.
It could happen since data taken not from DB - they are “streamlined”.

That is what I am seeing here, but the state data should be recording. When I go to history and specifically look at my sensors, there is no data.

Then I am confused - are you talking about an entity which is included or excluded from Recorder?
Excluded → no history (except realtime “streamlined”).

The domain is excluded but the entity id is included. Which according to the docs should equate to include.

This is good to know.
I took the advice of @tom_l and just use only the includes. This appears to have fixed my no history problem.

If the 12-day limit of my glucose history is continued, I will start another thread.

Oddly, when reading the post from @tom_l , my post appeared again as a draft.