Love the idea, could you provide a little bit more of direction ?
So basically the idea is to use Home Assistantâs REST API instead of loading into Lovelace/Home Assistant. It is MUCH lighter.
To do that you just need to create a Long-Lived API Access Token inside Home Assistant that the html page uses to authenticate into HASS. You create that token in the user profile menu under the Security tab.
Next youâll want to create a HTML file in the âwwwâ subfolder in HASSâs config folder, which you point your fridgeâs browser to.
The page just runs a simple javascript loop that pings /api/states every X seconds using the access token you created, and you can style your âcardsâ however you desire.
Example html page:
<html>
<body>
<h1>Sun Status: <span id="sun-state">Loading...</span></h1>
<script>
const TOKEN = 'Put your generated API token here';
async function checkSun() {
try {
// Ping Home Assistant
const res = await fetch('/api/states/sun.sun', {
headers: { 'Authorization': `Bearer ${TOKEN}` }
});
// Parse the data and update the text
const data = await res.json();
document.getElementById('sun-state').innerText = data.state;
} catch (error) {
document.getElementById('sun-state').innerText = "Error connecting";
}
}
// Run immediately, then check again every 10 seconds
checkSun();
setInterval(checkSun, 10000);
</script>
</body>
</html>
I got this :
type: custom:youtube-video-card
video_id: XG-6PHWsxoU
autoplay: true
loop: true
view_layout:
position: sidebar
and still it does got to the screensaver. do you have a screen saver enabled ?
I would love to not disable the screensaver because i want the screen to turn off at night, so i need to hide/disable the trick for the night
the best would be enable disable the screen by HA.
Like i would love to use my presence sensor in the kitchen to turn on or off the screen of the fridge