Exclude update_event from history and logbook

Hi all, somehow I am unable to exlude the following automation from flooding my history and logbook:

alias: Update TP-Link HS110
description: ''
trigger:
  - platform: time_pattern
    seconds: /5
condition: []
action:
  - service: homeassistant.update_entity
    data:
      entity_id:
        - switch.energiemeter_pc
        - switch.energiemeter_tv
mode: single

I’ve done the following in configuration.yaml, but is not fully helping yet:

recorder:
  purge_keep_days: 4
  exclude:
    event_types:
      - update_entity
      - homeassistant.update_entity
    entities:
      - automation.update_tp_link_hs110
      - switch.energiemeter_pc
      - switch.energiemeter_tv

logbook:
  exclude:
    entities:
      - automation.update_tp_link_hs110
      - switch.energiemeter_pc
      - switch.energiemeter_tv

When deleting home-assistant_v2.db, restarting Home Assistant, and SQL’ing the newly created home-assistant_v2.db, i still see flooding of the database:

select count(*) a, event_data
from events
group by event_data
order by a desc;
{"domain": "homeassistant", "service": "update_entity", "service_data": {"entity_id": ["switch.energiemeter_pc", "switch.energiemeter_tv"]}}

→ 15 times.

How can I prevent this flooding from happening?

Alternatively you could fix the switches so they do not need updating via an automation.

Could you post the config for one of them?

Hi, i get your point of view. The update policy is defined via the TP-Link Kasa Smart integration:

How/where can i get the config of the switches?

Bij the way, a reqeust to increase the scan interval of this integration is made. The request is not gaining a lot of traction though:

Small bump :wink: I guess there must be some kind of solution around this? Espcially in the context of the latest release ( Disable polling updates on any integration):

If there is no solution available for this, the new “disable polling update” feature is not very useful, imho. Nobody want to flood their database.

That’s not the event type. You’re looking at the event data… look at the event type with the matching event data and filter from there.

Also, that look’s like a service call event, so you probably won’t want to filter service calls. You’d be better off excluding the homeassistant domain.

FYI the entities filter does not work on events. You’re filtering out that entities state changes, not events. So your entities filter is just removing the history of your switch.

recorder:
  purge_keep_days: 4
  exclude:
    domains:
    - homeassistant

logbook:
  exclude:
    domains:
    - homeassistant
2 Likes

Thank you very much Petro! That is the solution I was looking for :+1: :tada:
tom_l : thank you too for helping out.