I have a few MQTT sensors, some of them are added from yaml files and some are added with MQTT discovery.
The devices added with yaml have history, but the ones added with MQTT discovery have none.
The discovery sensors have the following flags device_class, unit_of_measurement, value_template, name, force_update and retain.
sensor.peter_train_from_work_late added manually and it has history, sensor.plant_sensor_1_moisture is added with discovery and it has no history.
99% of my devices are mqtt and auto-discovered, and they all show history. So maybe you show your configuration.yaml, so we can see why you don’t have history.