ASUSWRT device tracker

I’m trying to configure the ASUSWRT device tracker. I can’t get the configuration to read teh ssh_key though. This is the configuration I have:

device_tracker:
  - platform: asuswrt
    host: [router ip]
    username: [username]
    port: [ssh port]
    ssh_key: /root/.ssh/id_rsa

But I’m getting this error:

2017-08-15 15:27:08 ERROR (MainThread) [homeassistant.config] Invalid config for [device_tracker.asuswrt]: not a file for dictionary value @ data['ssh_key']. Got '/root/.ssh/id_rsa'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/device_tracker.asuswrt/

/root/.ssh/id_rsa is the valid private key generated for the pi. And I’m able to ssh into the router from the pi terminal. Is there something I need to do, so the private key can bee seen by Hass?

I’m not using the asuswrt device tracker but should the ssh_key be

ssh_key: /root/.ssh/id_rsa

root/ isn’t the same as /root

You are correct. But that is what I have been doing. I edited my post with the actual path I’ve been trying.

HASSIO uses ResinOS underneath. ResinOS utilizes Docker containers - basically like running each program in it’s own VM, but with two key differences - Docker eliminates the need for each ‘container’ to have it’s own set of libraries, etc and each container does not have it’s own operating system.

Since Home Assistant is running in a container, isolated from the rest of the system, when you’re typing ssh_key: /root/.ssh/id_rsa the Home Assistant container is searching for /root/.ssh/id_rsa within it’s own file system, seperate from what you see when managing Hass. io via SSH.

You’re likely thinking that you need to somehow get the id_rsa file in the container’s filesystem. However, this is not a good solution. Because of how Docker works, the filesystem in each container is not permanent, meaning it does not persist between restarts of the container.

To resolve this problem, Docker implemented something called volumes. Volumes are a way for your Docker container to see files that exist on your host’s filesystem (where you’re storing your id_rsa file). HASS. io automatically mounts the /data folder on your host’s filesystem to /data within the Home Assistant container as a ‘volume’. So, to resolve your issue, copy or move id_rsa to /data/.ssh/id_rsa and reference it within the config like this: ssh_key: /data/.ssh/id_rsa
EDIT: If /data does not show up in the HASS container for some reason (I just assumed it would via some Googling), put the file in Home Assistant’s config directory and use /config/.ssh/id_rsa instead.
Here is some more in depth explanation about how Docker’s filesystem works. http://container-solutions.com/understanding-volumes-docker/.

I’d recommend you learn Docker if you want to keep using HASS. io: http://training.play-with-docker.com/

1 Like

Thanks. Putting it in /data/.ssh/. But it pointed me in the right direction. It is caused by the docker not seeing the folder. But for some reason it didn’t see the .ssh folder when I created it in /data/. But moving it into config worked.

Also thanks for those links, those will help a lot.

Ha, just noticed your edit.

1 Like

It seems my ASUSWRT is adding devices non stop. I recently had so many devices the device tracker stopped responding; purging the known_devices.yaml fixed it.
Is there a way to tell it to stop adding devices?

my config:

device_tracker:

  • platform: asuswrt
    host: 192.168.1.X
    username: Super secret username
    password: Super secret password
    interval_seconds: 10
    consider_home: 180
    track_new_devices: no

Thanks in advance