[SOLVED] ESPHome Devices Showing as 'Offline'

My intention was to create two simple ESP32/AHT20 temperature sensing devices, and experiment with ESP-NOW capabilities. My play was to get the two devices working, then gradually add the specific communication protocols.
Device#1: initiated in ESPHome, and added appropriate lines of sensor code. Device#1 operated perfectly, reporting temperature and humidity.
Device#2: prepared exactly the same way, remains ‘offline’.
I eventually deleted both devices and started again. Now both devices show ‘offline’. Yesterday, I was happily editing code and updating Device#1 through wifi. Today – nothing. Any thoughts?
I’ve encountered several other problems, but probably should attack these one at a time.

Follow-up:
Thanks Arh. Turns out the problem was not in my coding at all. Rather for some (yet undetermined) reason. My devices drifted in and out of the wifi connection. Perhaps proximity was a problem. In any event, all seems well with this portion of the project (today). I’m on to the next step, and likely the next question.

Show us the yaml for both devices, then we may be able to suggest something.

But just a guess is you have set IP addresses in the code, causing clashes.