Created
July 24, 2026 14:45
-
-
Save bruvv/4e555a7ba7e7f7f35ac105578e692877 to your computer and use it in GitHub Desktop.
Selecteert elke 60 seconden de volgende view van dashboard-f1111111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==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