Unwanted data transfert during nextion upgrade

I use Esphome to drive à nextion screen.
I also want to use the capability to upgrade the software of the nextion from home assistant through Esphome.
Each time I start the upgrade, the nextion starts its upgrade but stays stuck at the end with data corruption.
I suspect the issue is that ESPHome stays alive and send data’s during the upgrade as there are commands such as “on change xxxxx then ……”
I have tried to deactivate the inputs of the sensors involved with changes and the upgrade worked without any issue .
Is there a mean for Esphome to know that such upgrade has been asked and stops any other data transfer ?
Thanks per advance