So I have no problem setting up the history/recorder, but having a look into my database it is filled with call_service and service_executed events (even after excluding all entities).
With my setup, an automation fires off when an MQTT message is recieved. This automation fires off another MQTT message and this happens every second or two, so the call_service/service_executed events add up very quickly.
RobDYI seems to have had the same problem and ran a script to delete these (superfluous?) database records here, but the whole script thing is beyond me without some sort of guide.
Is there any way to disable the recording of these events into the database? I’m running the latest version with hass.io.
These are the commands I run every night. They work on from terminal and I have them in script together. I think they will work in shell command in HA. (I use mysql with hass as my username and password in database HOMEBASE)
This remove 90% of the rows in my HA database but doesnt change the size of the database that much.
#!/bin/sh
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'service_removed'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'service_executed'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'platform_discovered'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'homeassistant_start'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'feedreader'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'service_registered'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'call_service'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'component_loaded'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'logbook_entry'";
mysql -uhass -phass HOMEBASE --execute="DELETE FROM events WHERE event_type = 'system_log_event'";