For anyone else that’s experiencing their ESPHome devices rebooting every 5 minutes because the devices can’t talk to Home Assistant, due to this DNS bug, the cause seems to be that by default they will reboot every 5 min when the client can’t connect to the API. This can be changed with “reboot_timeout” variable. link This is causing my ESPHome controlled lights to flicker every 5 minutes. I might change this setting to 12 hours instead. I guess it can be completed disabled with the value of 0 if desired, but then you’d have to do the power cycle manually if they lock up.
Or you could set the reboot_timeout to 0 then create a binary_sensor to detect a connected switch patter to trigger areboot. Which is what I do for my switch controlled sonoffs & shellies.
binary_sensor:
- platform: gpio
pin:
number: GPIO3 # (RX Pin) - if using the newer Sonoff Basic with Wires instead of traces
#number: GPIO14
mode: INPUT_PULLUP
#inverted: True
id: wall_switch
filters:
- delayed_on: 200ms
- delayed_off: 200ms
on_press:
- switch.toggle: relay_template
on_release:
- switch.toggle: relay_template
on_multi_click:
- timing:
- ON for at most 0.5s
- OFF for at most 0.5s
- ON for at most 0.5s
- OFF for at most 0.5s
- ON for at most 0.5s
- OFF for at most 0.5s
- ON for at most 0.5s
- OFF for at least 0.2s
then:
- switch.turn_on: restart_sonoff
Yes, I had seen snicker’s post on that. It’s a cool option! I plan to integrate that also! Thanks for sharing. link
any update on the dns bug?
Today i flashed some of my esphome multisensors with a static ip and they worked for a minute before disappearing again. So it’s pointless. Reflashed them back to wifi domain: .lan .
Im seriously thinking about abandoning ESPHome and going to Tasmota…
This is not an ESPhome issue. This is a hassio issue.
And yes it should be fixed.
Go to your Hassio menu, click on the SYSTEM view and check that your Hass.io supervisor version is 181. If not, issue this command in the hassio CLI:
hassio supervisor update
If you are up to date or after updaing it still is not working go back to the CLI and issue these two commands:
hassio dns options --servers dns://IP_ADDRESS
hassio dns restart
Where IP_ADDRESS
is the address of your DNS server (your pi-hole).
Yup, having the latest supervisor version but still not working.
I’ll try updating the dns://pi-hole ip address through the CLI but what if the issue gets fixed by hassio admins and i need to revert back to the default dns:// address?
It has been fixed but it uses 1.1.1.1 and 9.9.9.9 as the DNS servers. These won’t work because of your pihole. This is the recommended fix for people with setups like yours.
https://github.com/home-assistant/hassio/issues/1231#issuecomment-522312855
One thing I forgot to mention is to make sure your SSH addon is up to date before trying the DNS commands.
before i changed my dns servers to my piHole’s IP i checked and they were 1.1.1.1 and 8.8.8.8 (not 9.9.9.9)
After changing the dns server (with CLI) to my piHole ip and with supervisor 181 and hass.io 0.97.2 (on raspberry pi 3B+)
issue is solved.
Interesting. Last I read they changed the second DNS from Google (8.8.8.8) to quad9 (9.9.9.9) as people were freaking out (mildly complaining) about privacy.
You got it to work. That’s the main thing.