Is there a way to launch an automation that executes this command:
ha network update wlp1s27u2 --wifi-auth wpa-psk --wifi-mode infrastructure --wifi-ssid SSIDTEXT --wifi-psk PASS
I have a wifi that goes down sometimes, I have created a sensorbynario that pings to know its status.
With the command that I passed via shell I can reconnect the Wi-Fi, but I don’t know how to automate it.
I have an issue with Home Assistant Supervised losing the DNS setting for static IP settings in network settings on every reboot and I have concocted this workaround you can use for your issue as well.
Install SSH Addon, I use the “Advanced SSH & Web Terminal”
service: ssh_command.exec_command
metadata: {}
data:
port: 23
user: root
pass: password
host: 172.17.0.1
command: ha network update eth0 --ipv4-nameservers 192.168.1.1 --ipv6-method auto
mode: single
Obviously change username, port and password above to match your setup for “Advanced SSH & Web Terminal”
host: 172.17.0.1 works for ha network and other ha cli commands.
In your case the automation trigger would be your ping fail and
command: ha network update wlp1s27u2 --wifi-auth wpa-psk --wifi-mode infrastructure --wifi-ssid SSIDTEXT --wifi-psk PASS
Another way to do this is to setup password-less SSH and use a shell_command but AlexxIT’s SSHCommand is easier to setup, just not as secure as the password is in plain text in the automation.