Hass.io install on RPi3B becomes unreachable 1-2 times per 24h

First of all, yes, I’ve tried another power supply and new SD-card. This Pi has been running Hassbian stable for at least a year and before that it ran as a Kodi box. It has been extensively stress tested with this PSU without issues. Recently upgraded from a Hassbian install to Hass.io and that’s when the problems started.

I’m running the latest version of HA (0.100.3).

The issue I’m experiencing is that the Pi becomes completely unreachable once or twice every 24h. Front-end down obviously, not reachable by SSH and it’s off the network (can’t ping the IP). On reboot everything seems normal, but logs are cleared so I have no idea what’s causing this.

How would I go about trying to troubleshooting this? Is it possible to enable persistent logs somehow?

Connected by wifi or lan?

Sorry, forgot to mention that. Connected by Wifi. I just realized that. Going to try Ethernet to see if that solves the problem.

Yeah had this problem also with wifi. If it drops it will not reconnect. Used a script fot that

1 Like

I see. That’s unfortunate. Never had that problem running Hassbian. Twelve hours in using Ethernet and so far so good :slight_smile: Hopefully it stays that way, I don’t mind using Ethernet. Thank you for the suggestion.

Yup, seems like that was indeed the issue. No dropout yet using Ethernet. Issue “solved” it seems. Thank you very much @John_P

Would you mind sharing your script to overcome the wifi reconnect issue ?
Thank you !

#ping the router to check the wifi connection
ping -c4 192.168.178.01 > /dev/null

# if exit code ($?) of the ping command is failed (not 0) then reconnect
if  [ $? != 0 ]
then
#       sudo ifconfig wlan0 up
       /sbin/wpa_cli -i wlan0 reconfigure
fi

in usr/local/bin/checkwifi.sh

Run in cron

How to run in cron on hass.io? (on RPi3B+)
The usr/loca/bin/checkwifi.sh file has to be modified in permissions by chmod?

See if you can run it from the config folder (with your yaml files). Everthing in HA runs as root so permissions should be ok.
I would try using Portainer and running a console in the Home Assistant container and seeing if it runs from in there.
Then set up the script as a shell_command and use an automation to run the script as often as you think it necessary. (you can’t run cron directly in hass.io)

Thanks for the reply.

Not working in /config folder.
used chmod 755 on checkwifi.sh, executed and not worked.
Moved in /sbin folder, executed and not worked…
Modified with nano checkwifi.sh in

/bin/ping -c4 192.168.1.254 > /dev/null
if  [ $? != 0 ]
then
       /sbin/wpa_cli -i wlan0 reconfigure
fi

executed it says: Syntax error on line 6 unexpected end of file (expecting “then”) :face_with_raised_eyebrow:

Not worked…

try executing the individual commands in the home assistant container using portainer…

I’ll do tomorrow, now it’s a bit late… I’ll write here my results… I’ve read on google that one possible command for solve this issue is reboot , not wpa_cli… I’ve see even that there isn’t wpa_cli in hassio /sbin directory.

don’t use reboot… you will end up with a dead sd-card
see if you can copy wpa_cli to /config… see that’s why I suggest running it from the home assistant container because you will only be able to access things in a shell/script that you can access in the container and checking there will save a lot of trial and error.

Thank you for your careful suggestion. I’m not very practical with Docker and Container. Would you please suggest me how to do it, having a little patience? I will be immensely grateful to you. I have already installed Container, but honestly the warnings about the security of the system and the fact that I could destroy everything worry me a little. Also I just can’t find the executable wpa_cli … can I find it with Google? (meanwhile I try) …

Ah, another little doubt. If I changed the image of the system in Container, when the updates will be there I will not lose all the work done?