Attempting MQTT connection...failed, rc=-2 try again in 5 seconds

Kinda strange. Everything was working a week ago. There was no updates on libraries/HAOS, esp8266’s code wasn’t changed. I haven’t updated anything. ;/
edit: what I noticed that on another esp where I got esphome installed I got warning like


“WARNING Can’t connect to ESPHome API for esphome-sensors.local: Error resolving IP address: [Errno -2] Name or service not known” and there is OFFLINE label:

But the sensor works: it shows the motion
image