Strange Environmental Sensor Values Following restart

I am seeing an odd behavior with some environmental sensor values when HA gets restarted.
Context: A set of ecowitt sensors that report temperature/humidity/heat index/etc to the ecowitt bridge device. The device reports to a server app that transforms the values into MQTT publications that comply with the HA autodiscovery specification.
My HA instance is a HAOS running in a VM, with a separate MQTT broker running on a different system.

If i restart the HA instance, at the time of restart, I end up with a discontinuity in the sensor data. Temperature values report a higher value - for a given sensor, the value is the same each time, and the values reported by the different sensors are different. The humidity sensors show a corresponding reduction in value - same behavior - same value each time, different for different sensors. I would add that the MQTT broker was not restarted at any time.

The messages do not use retained pubs, so I would not expect the HA sensors to show the correct value until the next publication from the corresponding ecowitt sensor.

The question is, where do these discontinuous values come from? Its odd that the temperature values are all higher and the humidity values are all lower, pointing to a consistent set of values sometime in the past, put where are these coming from, and how do i get rid of them?

Update, I just restarted HA again, and all of the temperature/humidity sensors jump to the same value they did last time I restarted. Presumably this has to be something in the database.

I can’t see any reason why it would be.

Are you feeding these sensors to other integrations or platforms like templates or sensor filters?

Or are you using mqtt sensors that have a value_template?

Not feeding the sensors into anything else - this is a set of (supposedly) straightforward environmental sensors that deliver MQTT data via the gateway server. I am not doing anything with them other than using the auto-defined entities.

I did some additional checking this morning, and the behavior is even more peculiar than I first observed.

Looking in the history, when the HA is restarted, I see a discontinuous value approximately 20 seconds later. Immediately after that, the history shows no values until approximately 2 minutes 42 seconds late. At that time (which is the next reporting iteration from the server), I see another discontinuous value (the one I originally observed) followed immediately by a correct value.

The first discontinuous value immediately following the reboot is different each time. The second discontinuous value - immediately before the first correct value is reported is always the same for a specific sensor.

The whole sequence is 100% repeatable and occurs with all of this particular set of sensors. I have a couple of other sensors that also use MQTT auto-discovery that do not exhibit this problem - the difference with those is that I implemented the MQTT publishing component myself.

I am wondering if there is something odd in the discovery topic for the others, but I cannot imagine any mechanism that would cause this kind of effect.

One difference I just noticed between the problematic and non-problematic sensors in the log is that the problematic ones repeatedly report “Component has already been discovered”. The non-problematic ones do not do that.