Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add redirects to the Home Assistant sidebar to any place in Home Assistant
Add a link to the sidebar to any path in Home Assistant
Put this file in <config>/www/panel-redirect.js
In configuration.yaml:
- name: panel-redirect
# url_path needs to be unique for each panel_custom config
url_path: redirect-server-controls
sidebar_title: Server Controls
sidebar_icon: mdi:server
module_url: /local/panel-redirect.js
# Where you want to redirect to
target: /config/server_control
class PanelRedirect extends HTMLElement {
connectedCallback() {
if (this._info) {
set panel(info) {
this._info = info;
if (this.isConnected) {
_navigate() {
history.replaceState(null, "",;
const event = new Event("location-changed", {
bubbles: true,
composed: true,
event.detail = { replace: true };
customElements.define("panel-redirect", PanelRedirect);
Copy link

vando commented Feb 21, 2021

I was looking for a way to have quick access to Server Controls, thank you!


Copy link

drinfernoo commented Nov 3, 2021

Could this be adapted to allow a particular panel to be opened in a new window?


Copy link

Acqua-H commented Nov 8, 2021

Many thanks @balloob !
Actually, in current Home Assistant, this did not work and I received a blank page when clicking on the “Server Controls” item in the sidebar by using the above config in configuration.yaml.
I have fixed it accordingly, also with an example of adding a second menu item:
Github Gist: Acqua-H/panel-redirect

P.S. HA forum discussion link: How to add a “Restart Home Assistant” button to Sidebar?


Copy link

drinfernoo commented Dec 5, 2021

Working fine here 🤷


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment