Filter logbook view?

Hey Everyone,

Is there a way to dynamically filter out what values from an entity are returned from the logbook card view?

I want to capture all values in the logbook, but sometimes I don’t want to see specific values from an entity. Here is an example.

In this example, the device network connection keeps flipping back and forth from connected to unavailable (maybe the vacuum is under some thick object or something) and flooding the log. I want to keep these values for later analysis, but I would like to not see “none” and “unavailable” for right now so I can look for other error messages in the log for this entity.

This is just an example dataset, so don’t get hung up on why the vacuum is unavailable or that I’m logging unavailable in the first place. :wink: The focus of this question is temporarily filtering one or more logged value types from the current entity’s log list view.

Can this be done?

Thanks and have a great day!!

If i understand correct you can work around this with some customization.
this should be possible like this, but i can not test this.

  1. Create a New Entity: Create a new helper input_boolean or input_select entity that you can use to control the filtering. For this example, I’ll use an input_boolean entity.
  2. Create an Automation: Create an automation that listens for changes in this input_boolean. When the input_boolean changes to a specific state (e.g., ‘on’), this automation should perform an action. The action will be to create a new logbook entry with the desired message you want to see instead of the “none” or “unavailable” entries. For example:
alias: Logbook Filter Automation
  - platform: state
    entity_id: input_boolean.filter_logbook
  - service: logbook.log
      name: "Vacuum Status"
      message: "Changed to {{ trigger.to_state.state }}"
  1. This automation logs an entry every time the input_boolean changes state, indicating the new status you want to see in the Logbook.
  2. Configure the Logbook Card: In your Lovelace dashboard, create a custom Logbook card. You can do this by editing your Lovelace configuration. In the card’s configuration, you can add a filter to hide entries with specific message content. For example:
type: logbook
  - entity: vacuum.your_vacuum_entity
  - name: 'Vacuum Status'
    state: 'Changed to on'
  1. In this configuration, you specify the entity you want to show in the Logbook card. The show section filters the log entries. In this example, it shows entries where the message name is ‘Vacuum Status’ and the state is ‘Changed to on’.
  2. Control the Filtering: Now, when you change the input_boolean entity’s state to ‘on’, the automation logs a custom entry with the message you want to see. You can adjust the Logbook card to show only these custom entries by changing the show configuration as needed.

By using this method, you can dynamically filter out specific values from an entity’s log and customize what you see in the Logbook card. You have control over what messages are displayed by changing the state of the input_boolean entity and adjusting the Logbook card configuration accordingly.

Thank you for the reply! I appreciate your efforts!!

However, the focus is on the log viewer. There are many different values in lots of different entities that I want to filter out or focus on at any time for whatever reason. Creating a whole new entity and/or automation is an incredible amount of effort for what I need and only applies to future logged values and not entries that occurred in the past.

Just like the logbook can filter on the specific date/time range and a specific entity, I want the next granular level of viewing entity entries of a specific value or set of values. I would like to dynamically go to the log viewer and say, “Show me all occurrences of log value X for entity Y over the date/time range Z” or “Show me all log messages for entity Y over the date/time range Z except for log values A, B, and C” for all existing logbook entries, not necessarily future entries.

Does this clarify what I am going for?

Thanks again for your help!!