Just got device tracking working using the ubus configuration option for OpenWrt. Initially, I left track_new_devices set to yes, but I didn’t like how EVERY device on the network showed up in the UI.
Editing known_devices.yaml yielded some weird results. I really just want to track a handful of devices, so I set almost everything to track: no and hide_if_away: yes. After restarting HA, I was expecting that only the track: yes devices to appear in the UI, but instead there was no change. All network devices were still listed.
Then I noticed that the file had grown as well. Initially, it was maybe 120 lines (about 2 KB) or so, but it doubled in size after I edited it and all of the devices were listed twice. Pretty weird.
I tried deleting known_devices.yaml and restarting HA. This yields a new version of the file. But any time I modify anything in the file, all devices get scanned again and the file doubles in size.
I think you need to wait for it to grow to its count of all devices, then shut HA down and edit all the ones you don’t want to not track, then start up again, If you delete them they will be re-added. You can set the various device trackers to not add new trackers too. This is more of a problem for MAC address based trackers, for other trackers (iCloud, Owntracks, Locative) you only get one entry per device, e.g, all your Apple devices for iCloud, or just the devices running Locative or Owntrack.
Changed all the devices I did not want tracked in known_devices.yaml to track: no and hid_if_away: yes.
Saved the file.
Restarted HA.
Result: not only do the icons still appear in the UI, everything in the file got duplicated again! Initial file size is 2 KB, which has now grown to 8 KB.
There is a new entry in the log, however, which seems related:
16-07-20 08:32:29 homeassistant.util.yaml: while scanning an alias
in “/home/chad/.homeassistant/known_devices.yaml”, line 3, column 9
expected alphabetic or numeric character, but found ‘\n’
in “/home/chad/.homeassistant/known_devices.yaml”, line 3, column 10
Looking at known_devices_yaml, though, line 3 does not contain a string \n, nor does that string appear anywhere in the file. From what little I know about YAML, \n appears to signify a new line?
The device defined on line 3 looks like the below. Could the asterisk be causing problems?
111111111111:
name: *
mac: 11:11:11:11:11:11
picture:
track: no
hide_if_away: yes