How does Logbook work?

I noticed entries in the Logbook that record Time and Date state changes every minute. I followed an old topic to add Configuration YAML to stop logging Time and Date Loads of time changes in log => Error? also described at Logbook - Home Assistant

When I add YAML to Configuration to exclude Time and Date from Logger, ALL previously-written Time and Date entries disappear.

That make me think that ‘exclude’ is for READING from the Logbook and not WRITING to the Logbook, and that the Time and Date entries are written into the Logbook but are excluded from viewing the entries. I can’t imagine that ‘exclude’ would go back and delete previously-written Logbook entries.

Is this an accurate description of how Logbook works?

There is no such a thing - “writing to Logbook”.
Entities’ states and attributes are written to DB (unless they are manually excluded from Recorder).
Logbook page shows a history of states for entities taken from DB (in fact, not all entities are present in logbook - particularly numerical values with units are not shown).
Excluding an entity from Logbook = not showing it’s history in Logbook page (although it is still possible to select this entity manually at least in Logbook card, not sure about a Logbook page).

1 Like

You would be better served by excluding the Time & Date sensors from the Recorder.

1 Like

That’s interesting. I created a sensor that calculates sump pump runtime and another calculates seconds per run. I see seconds per run in the Logbook, runtime is not shown.

Ok. Logbook is a filtered db viewer. I understand that part now.

Thanks!

Will excluding Time and Date from Recorder still allow dependencies to react to time events and Traces to display time-dependent automations?

The Time and Date integration sensors have nothing to do with Time or Time Pattern triggers, or Time conditions.

And, yes, the sensors will still work in automations, etc. They are still present in the state machine and event bus, they just aren’t written into the DB.

1 Like

Actually, there is. :slight_smile:

Sorry, what do you mean?

You can write manual entries to the logbook. Check the end of that page.

script:
  add_logbook_entry:
    alias: "Add Logbook"
    sequence:
      - action: logbook.log
        data:
          name: Kitchen
          message: is being used
          # Optional
          entity_id: light.kitchen
          domain: light
1 Like

I see, you mean manual log entries, so technically you can add manually records (they are not taken from DB).

1 Like

When I exclude Time and Date changes from Recorder, is it redundant to also exclude from Logbook?

Yes.

1 Like