My approach to cleanup the InfluxDB:
Execute the query: SHOW TAG VALUES ON "homeassistant" WITH KEY = "entity_id"
and create a dashboard of if.
You get an overview of entities in the DB.
Next, you can delete unwanted entities completely:
Exclude the entity from being written to the InfluxDB again.
EDIT: I personally prefer the include-only configuration of the InfluxDB. This prevents the test entities to be written to the long-term InfluxDB. If a HA entity becomes stable and it has sense to collect its data, I include this entity to the DB configuration.