PM sensor - stopped working occasionally ESPHome

I made DIY Pro 4.2.
Works good but PM sensor sometimes display NA for all 1, 2.5 and 10.
Do you have any ideas why?

I see that when my device reboots. It doesn’t have any data from the sensor on this boot yet, so it displays NaN which means Not A Number.

After an interval, it gets a value and shows it.

In my config I only get a new value every 2 minutes to try to reduce log messages and extend life of the sensor. It could be changed to the default values which updates every second and would get a valid number more quickly.

Can you share your code?

MallocArray/airgradient_esphome: ESPHome definition for an AirGradient DIY device to send data to HomeAssistant and AirGradient servers (