Esphome unavailable alarm tiggered

Hello everyone, I have a question, I have magnetic sensors connected to esp8266 with esphome on board, sometimes it becomes unavailable and consequently the alarm is triggered, how could I resolve it (clearly both HA and EHome updated to the latest version)

Only trigger on the change of state from ‘off’ to ‘on’, not ‘unavailable’ to ‘on’.

so it’s a coincidence, I add the automation of the trigger from closed to open in the settings