washcroft / HttpGarageDoorController

A project for an Arduino based WiFi-enabled controller, IoT/M2M enabling an ordinary garage door operator.
MIT License
11 stars 4 forks source link

i fixed Homebridge "...cannot find garagedoorcontroller.local:80" etc by editing hosts file on pi #12

Open lagunacomputer opened 5 years ago

lagunacomputer commented 5 years ago

i fixed Homebridge "...cannot find garagedoorcontroller.local:80" etc by editing hosts file on pi

I could not figure out why my NodeMCU/ESP8266 would disconnect and reconnect, I thought it was a problem with wifi reception but it wasn't.

Turns out mdns/avahi stops finding the dns name "garagedoorcontroller.local" quite often in my case. Simply adding the ip and dns name as a host file entry on my raspberry pi running HomeBridge was the answer. My ip of my arduino is 192.168.1.59, so i added the line "192.168.1.59 garagedoorcontroller.local" to my /etc/hosts file using the sudo nano /etc/hosts command, and BAMO, HomeBridge could find the device every time and no more errors.

Obviously you want a static IP on the arduino or a DHCP reservation in your router so that it always gets the same ip. If the arduino or ESP8266 ip should change, you would need to change it in hosts file too.

Hope this helps someone, I struggled for hours with this.