Skip to content

Instantly share code, notes, and snippets.

@bruvv
Created July 24, 2026 14:45
Show Gist options
  • Select an option

  • Save bruvv/4e555a7ba7e7f7f35ac105578e692877 to your computer and use it in GitHub Desktop.

Select an option

Save bruvv/4e555a7ba7e7f7f35ac105578e692877 to your computer and use it in GitHub Desktop.
Selecteert elke 60 seconden de volgende view van dashboard-f1111111
// ==UserScript==
// @name Home Assistant dashboard rotator
// @namespace local.home-assistant
// @version 1.0.0
// @description Selecteert elke 60 seconden de volgende view van dashboard-f1111111.
// @match http://10.92.102.75:8123/dashboard-f1111111/*
// @run-at document-idle
// @grant none
// ==/UserScript==
(() => {
'use strict';
const findTabs = (root = document) => {
const tabs = [...root.querySelectorAll('ha-tab-group-tab[role="tab"]')];
// ponytail: volledige shadow-DOM-scan; gerichter maken als dashboardgrootte ooit merkbaar vertraagt.
for (const element of root.querySelectorAll('*')) {
if (element.shadowRoot) tabs.push(...findTabs(element.shadowRoot));
}
return tabs;
};
const selectNextView = () => {
const tabs = findTabs();
if (tabs.length < 2) {
console.warn('Dashboard rotator: minder dan twee dashboardtabbladen gevonden.');
return;
}
const current = tabs.findIndex((tab) => tab.getAttribute('aria-selected') === 'true');
const nextPath = tabs[(current + 1) % tabs.length].dataset.path;
location.assign(`/dashboard-f1111111/${nextPath}`);
};
setInterval(selectNextView, 60_000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment