AsusWRT device tracker not working with SSH

I would like to connect to my ASUS router using asuswrt.

I am getting this error message:
16-11-26 21:01:48 homeassistant.components.device_tracker.asuswrt: Connection refused. Is SSH enabled?

I am using this configuration

device_tracker:
  platform: asuswrt
  protocol: ssh
  username: admin
  host: 192.168.2.1
  interval_seconds: 10
  ssh_key: /home/hass/.ssh/id_rsa.pub
  track_new_devices: yes

I have verified that I can login from the command line. Using a password doesn’t work either (yes, I allowed that in the router)

(hass)
hass@raspberrypi: ~
$ ssh [email protected]
admin@(none):/tmp/home/root#

Activating telnet on the router, changing protocol to ‘telnet’ seems to work.

Hi martisak

Did you get any joy getting SSH connections to your ASUS router working? I just tried on my ASUS DSL AC-56U modem router and not having any joy with SSH, getting the following:

ERROR (Thread-8) [homeassistant.components.device_tracker.asuswrt] Unable to connect via SSH: could not set shell prompt (received: b" unset PROMPT_COMMAND\r\n# PS1=’[PEXPECT]\$ ‘\r\n[PEXPECT]\$ set prompt=’[PEXPECT]\$ '\r\n[PEXPECT]\$ ", expected: '\[PEXPECT\][\$\#] ').

Was working fine before, but now I get this problem as well.
I upgraded to Firmware Version:3.0.0.4.380_7378 on my RT-AC87U, so maybe that is related.
I refreshed my ssh keys after the upgrade, but no luck.
Anyone solve this?

Thanks

This config works for me:

#ASUS RT-AC56U
# Operation Mode:Wireless router
# Firmware Version:3.0.0.4.380_7743
# Add public ssh key to Asus router.
# configuration.yaml entry, point to private ssh key
device_tracker:
  - platform: asuswrt
    host: 192.168.0.1
    ssh_key: /home/homeassistant/.ssh/id_rsa
    username: admin

I have Asus firmware on my R7000 and the issue is still present.

Here’s my config:

  platform: asuswrt
  host: 192.168.x.x
  username: admin
  password: xxxxxxxxx
  interval_seconds: 10
  consider_home: 180
  track_new_devices: yes

I always receive this error:

[homeassistant.components.device_tracker.asuswrt] Connection refused. SSH enabled?

any hint?

Make sure you have SSH activated in the router. Older firmwares doesn’t have SSH. Check in the router under “Administration / System / Enable SSH” (might differ how to get to the SSH-part in your router model).

You can also try using ssh to the router from your HA-servers terminal.

Or check that port 22 (or whatever port you’re using for SSH in the router) with nmap. Example:
nmap -sT -O 192.168.0.1

1 Like

Same story here. This worked for me before, but broke earlier this year. I’ve confirmed I’m still able to ssh from the HA machine to the router manually, so it looks like either an asus update or a HA update broke it. Tend to lean more towards HA.

and yet, I’m on the latest version of HA and running an Asus Merlin firmware variant (380.66_4) which I constant keep upgraded as quickly as I can, and have never had an issue with SSH device tracking.

Hi,
I’m trying to use AsusWRT on my AC68U
I tried both telnet and ssh by username and password. Same return as SSH enable?
on the router log. it says login attempt from nonexsistent user.
I can login from my raspberry pi by ssh [email protected] it works.
Any suggestion?

device_tracker:

  • platform: asuswrt
    host: 192.168.*****
    username: admin
    password: *******
    protocal: telnet
    mode: router
    protocal: telnet
    track_new_devices: yes
    interval_seconds: 61
    consider_home: 180

protocal: telnet

should read
protocol: telnet

Note - you’ve got this line in twice as well…

As this is optional, I assume it’ll always try SSH due to the typo.

Thanks for pointing it out. I got it login in. Problem is the misspelling.
Now hass is able to login by telnet and WORKS OK. But it is returning some errors.

2017-09-24 13:56:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 331, in async_update_config
dev_id, device)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 739, in update_config
with open(path, ‘a’) as out:
PermissionError: [Errno 13] Permission denied: ‘/home/homeassistant/.homeassistant/known_devices.yaml’

there must be a permissions problem accessing “/home/homeassistant/.homeassistant/known_devices.yaml”

check the permissions on the file and make sure the user HA is running as has access, or maybe just delete it and restart HA and hopefully it should sort itself out

Thanks Pembo,
I might just delete it. ASUSWRT can list devices. Feel ok without known_devices.yaml

Check out the device tracker component category that ASUSWRT is one of.

It will recreate the file, and you might need to edit it.

1 Like

Thanks Pembo.

Sorry for recycling this old thread. But this issue is still present in my current setup: the asuswrt device tracker is not functioning with SSH, only with telnet.

Shouldn’t we file a bug report? How would I go about doing that?

I too need to report asuswrt component not working anymore with latest merlin firmware:

Connection refused. SSH enabled?
18:03 components/device_tracker/asuswrt.py (ERROR)

I can confirm ssh is enabled and working from putty

login as: admin
[email protected]’s password:

ASUSWRT-Merlin RT-AC68U 384.3-0 Tue Feb 13 21:08:43 UTC 2018
admin@RT-AC68U-4650:/tmp/home/root#

just had to double check, but based on the docu, I’m using SSH and it works for me (I’m using a Merlin firmware).

- device_tracker:
  platform: asuswrt
  host: 192.168.1.1
  username: <USER>
  password: <PASS>
  consider_home: 300
  interval_seconds: 15

documentation states:

Are you using SSH pass login or SSH key?
If pass, have you enabled SSH and in particular the option on the router to allow password login, i.e.

Allow SSH password login: Yes/No

I confirm using telnet protocol is working. I would prefer ssh but I can live with telnet until bug is spotted and fixed.

I’m on a slightly older version:
ASUSWRT-Merlin RT-AC68U 380.66-4