I just spent the better part of 4 hours trying to figure out something I thought would be a very simple task. Adding an ICON to the sidebar that sends you to a URL. I was doing this because the UniFI Admin add-on didn’t have an option for a sidebar icon. So here’s what I did.
Step 1: Add this to your configuration.yaml (You can also use !include and group your config in another file like I did but for simplicity of explanation see below)
## Unifi Admin
panel_custom:
- name: UniFi Admin
sidebar_title: UniFi Admin
sidebar_icon: mdi:alpha-u-box
url_path: unifi
module_url: /local/unifi_redirect.js
embed_iframe: false
require_admin: true
Step 2: Create a file in /config/www called unifi_redirect.js (or whatever else you just just be sure to change module_url above)
Step 3: In the file you just created put the following. Adjust to the url of your unifi system.
window.location.replace("https://<url to unifi>/");
Step 4: Reboot
Step 5: Test
That’s it. You should be able to adjust this to whatever URL you needed.
Notes:
- UniFi doesn’t like being inside an iframe so I pop it out. See step 1 where you can adjust that.
- In testing there appears to be an undocumented / unimplemented item called html_url. If it’s what I think it was intended to do it would have made step 3 unnecessary.
- Unfortunately you need to reboot each time you try and test something.
Good Luck!