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?
I see. That’s unfortunate. Never had that problem running Hassbian. Twelve hours in using Ethernet and so far so good Hopefully it stays that way, I don’t mind using Ethernet. Thank you for the suggestion.
#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
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)
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”)
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) …