In case someone has the same problem as me, below is the solution.
I generated the my key pairs on a windows machine using puttygen. This is a different machine from the home assistant machine (which is on rpi). I notice in the private key file, at the bottom, there is an entry private-MAC: xxx
I am not sure if this is referring to the mac address of the window machine (which obviously will be different from the rpi.
On the HA integration screen, when i hit ‘submit’ button, i got ‘unknown error’. The log looks like this:
Logger: homeassistant.components.asuswrt.config_flow
Source: components/asuswrt/config_flow.py:106
Integration: ASUSWRT (documentation, issues)
First occurred: 3:57:43 PM (2 occurrences)
Last logged: 3:59:41 PM
Unknown error connecting with AsusWrt router at 192.168.1.1
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/asuswrt/config_flow.py", line 106, in _async_check_connection
await api.connection.async_connect()
File "/usr/local/lib/python3.9/site-packages/aioasuswrt/connection.py", line 78, in async_connect
self._client = await asyncssh.connect(self._host, **kwargs)
File "/usr/local/lib/python3.9/site-packages/asyncssh/connection.py", line 6887, in connect
options = SSHClientConnectionOptions(options, config=config, host=host,
File "/usr/local/lib/python3.9/site-packages/asyncssh/connection.py", line 5596, in __init__
super().__init__(options=options, last_config=last_config, **kwargs)
File "/usr/local/lib/python3.9/site-packages/asyncssh/misc.py", line 271, in __init__
self.prepare(**self.kwargs)
File "/usr/local/lib/python3.9/site-packages/asyncssh/connection.py", line 6329, in prepare
self.client_keys = load_keypairs(client_keys, passphrase,
File "/usr/local/lib/python3.9/site-packages/asyncssh/public_key.py", line 3152, in load_keypairs
key, certs = read_private_key_and_certs(key, passphrase)
File "/usr/local/lib/python3.9/site-packages/asyncssh/public_key.py", line 2969, in read_private_key_and_certs
key, cert = import_private_key_and_certs(read_file(filename), passphrase)
File "/usr/local/lib/python3.9/site-packages/asyncssh/public_key.py", line 2864, in import_private_key_and_certs
raise KeyImportError('Invalid private key')
asyncssh.public_key.KeyImportError: Invalid private key
My solution is to generate the key pairs directly from HA via SSH.
In command line, use ssh-keygen
[core-ssh ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /config/ssh/lara_private_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /config/ssh/lara_private_key
Your public key has been saved in /config/ssh/lara_private_key.pub
The key fingerprint is:
SHA256:BLAHBLAHsdfasfdjfS/VgfQCZSA root@core-ssh
The key's randomart image is:
+---[RSA 3072]----+
| E oo+ |
| . |
| o o |
| . o |
| . .oS = + . |
| . oo= . . |
| . +oB.= . o |
| ..X=X= + |
| BLAH |
+----[SHA256]-----+
and like they say, the rest is history