As some of you may have noticed I am having trouble with modifying properties (name/picture/icon etc.) of my entitites.
Now I found that my devices exist multiple times in my known_devices.yaml, For example my phone exitsts about 10 times with the same mac_address in known_devices.
I think that when I modify one in customize.yaml Hassio does know which one to modify.
How can I change this, and what do I have to do when I want new devices to be discovered.
When I saw in the past that I had multiple entries for the same MAC in my known-devices.yaml, I just kept one and deleted the copies - worked fine and I did not get multiple entries bei created any more.
Wasn’t necessary for a long time but I hope it would still work.
@chairstackers: I have done that for two devices now and it is a lot of work. There are about 6000 line in my known_devices.yaml now while I it should be about 10% of that I guess.
Wow - that’s a lot. Sorry to hear that.
You wouldn’t happen to have a backup of the file from before it multiplied?
That saved me a lot of time on one occasion.
At the top of known_devices.yaml, after the devices you want to keep, put this line:
#end-of-my-devices#
Then create a shell_command in config yaml:
shell_command:
clean_knowndevices: /bin/bash /config/clean_knowndevices.sh
Then create an automation to run that shell command when HA starts:
- id: 'cleanknowndevices'
alias: Clean out Known Devices
initial_state: 'true'
trigger:
- event: start
platform: homeassistant
action:
- service: shell_command.clean_knowndevices
Finally, create clean_knowndevices.sh in config directory (with config yaml) and make it executable…
#!/bin/sh
/bin/sed -i '/#end-of-my-devices#/q' /config/known_devices.yaml
from ssh… chmod +x clean_knowndevices.sh
Then everytime HA restarts it will get rid of extra devices. If there are new ones you want to keep, just move them up above the line.
2 Likes
Thank you for this. I implemented it …now I have to wait if it works.
Next day … so far so good
1 Like