Problem with helper sensor for mean value

Hi, I have two temperature sensors (defined in ESPHome) for boiler. One is placed up in the boiler and second down. For automations I’ve created helper sensor of type “Combine the state of several sensors” with “Arithmetic mean” of the two sensors.

Everything worked fine before update of HA Core to 2023.5.0 on May 3. Since that mean value is sometimes set to value of one of two sensors:

Before that it happened very rarely that I even haven’t noticed:

I haven’t found any undefined value or something similar and have no idea how to debug the problem. As workaround (and maybe better solution) I just created calculated mean value directly in ESPHome, I can compare average values from both calculated sensors.

Do you have any idea why this happens?

I got an idea to zoom the view:

Here I can see that there really are some “holes” with unknown value. That explains the problem.

So the question is - is it possible to calculate the mean in helper sensor only when both sensors have correct number values?

The problem doesn’t occur anymore. The only thing I did was adding a calculated sensor with mean value directly to ESPHome. After this upload everything works also with helper sensor in HA.