3.1 KiB
3.1 KiB
Browser Mod Auto-Scroll Setup Guide
Where to Add the JavaScript Code
The JavaScript code goes in Home Assistant (on the server), NOT on the client machine. You have two options:
Option 1: Create an Automation (Recommended)
Step 1: Copy the Automation YAML
- Open
browser-mod-automation.yaml - Copy the entire contents
Step 2: Add to Home Assistant
Method A: Via UI (Easiest)
- Go to Settings > Automations & Scenes
- Click "Create Automation" (bottom right)
- Click the three dots (⋮) in top right
- Select "Edit in YAML"
- Paste the automation YAML
- Click "Save"
Method B: Via configuration.yaml
- Edit
configuration.yamlin Home Assistant - Add the automation YAML under the
automation:section - Restart Home Assistant
Step 3: Enable the Automation
- Make sure the automation is enabled (toggle switch should be ON)
- The automation will run when:
- Browser Mod browser is turned on
- Home Assistant starts
Option 2: Manual Service Call (For Testing)
If you want to test it manually first:
- Go to Developer Tools > Services
- Select service:
browser_mod.execute_script - Under Target, select your browser entity (e.g.,
browser_mod.browser_kiosk) - Under Service Data, paste this:
command: |
(function() {
const cards = Array.from(document.querySelectorAll('ha-card'));
cards.forEach(card => card.style.minHeight = window.innerHeight + 'px');
let i = 0;
setInterval(() => {
i = (i + 1) % cards.length;
cards[i].scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 5000);
window.scrollTo({ top: 0, behavior: 'smooth' });
})();
- Click "Call Service"
How It Works
- Browser Mod detects when the dashboard loads
- Automation triggers and waits 3 seconds for page to fully load
- JavaScript is injected into the browser (runs on the client, but code is stored in HA)
- Auto-scroll starts: scrolls to next card every 5 seconds
- Loops through all cards continuously
Troubleshooting
If auto-scroll doesn't work:
-
Check Browser Mod is installed:
- Settings > Add-ons > Browser Mod
- Should show as "Running"
-
Check browser entity exists:
- Developer Tools > States
- Search for
browser_mod.browser_kiosk - Should show state: "on"
-
Check automation is enabled:
- Settings > Automations & Scenes
- Find "Kiosk Dashboard Auto-Scroll"
- Toggle should be ON
-
Check browser console:
- Open dashboard in Firefox
- Press F12 > Console tab
- Look for "Auto-scroll script starting..." message
-
Manual test:
- Use Option 2 (Service Call) to test if JavaScript works
Files Reference
browser-mod-automation.yaml- Full automation with JavaScriptdashboard-auto-scroll.js- Just the JavaScript (for reference)dashboard-kiosk-with-scroll.yaml- Dashboard YAML with card-mod styling
Summary
The JavaScript code goes in Home Assistant as an automation, not on the client machine. Browser Mod handles injecting it into the browser automatically.