When adding a Zigbee or MQTT device, it is possible to define for each feature of the device whether you want to keep the history or not:
In the Zigbee2Mqtt integration:
In the Virtual Devices MQTT integration:

This is not possible for devices created by external integrations. It would be useful to be able to do this.
Hi everyone!
This topic is now in development.
A PR has been opened to allow configuration of history retention by feature on external integration devices:
Feel free to follow the PR, test (optional, especially for small requests), and provide your feedback here if needed.