# Browser Mod Auto-Scroll Automation # Paste this directly into Home Assistant Automation Editor (YAML mode) # DO NOT include the "automation:" wrapper - just paste the content below alias: "Kiosk Dashboard Auto-Scroll" description: "Auto-scroll dashboard cards every 5 seconds" trigger: - platform: state entity_id: browser_mod.browser_kiosk to: "on" - platform: homeassistant event: start condition: - condition: state entity_id: browser_mod.browser_kiosk state: "on" action: - delay: "00:00:03" - service: browser_mod.execute_script target: entity_id: browser_mod.browser_kiosk data: command: | (function() { 'use strict'; console.log('Auto-scroll script starting...'); const cards = Array.from(document.querySelectorAll('ha-card')); console.log(`Found ${cards.length} cards`); if (cards.length === 0) { console.error('No cards found!'); return; } cards.forEach((card, index) => { card.style.minHeight = window.innerHeight + 'px'; card.style.scrollMarginTop = '0px'; console.log(`Card ${index + 1}: Set min-height to ${window.innerHeight}px`); }); window.scrollTo({ top: 0, behavior: 'smooth' }); let currentIndex = 0; function scrollToNext() { currentIndex = (currentIndex + 1) % cards.length; const targetCard = cards[currentIndex]; if (targetCard) { targetCard.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }); console.log(`Scrolled to card ${currentIndex + 1} of ${cards.length}`); } } const intervalId = setInterval(scrollToNext, 5000); console.log('Auto-scroll enabled: scrolling every 5 seconds'); window.dashboardScrollInterval = intervalId; window.stopAutoScroll = function() { clearInterval(intervalId); console.log('Auto-scroll stopped'); }; })();