- Create
snowflakes.js
underconfig\www
folder. - Add content from the gist
- Choose to run always (remove all below line 4),
- Or by date (remove line 4, optionally editing the dates you want the snowflakes to trigger)
- and save.
- In HA, go to Configuration > Lovelace Dashboards > Resources.
- Click 'Add Resources' and enter
local/snowflakes.js
(it's a JavaScript module) - Save it
- Enjoy the holidays
Last active
December 20, 2024 21:33
-
-
Save DavidDeSloovere/44e5e56cb13f4662f18021b32587f374 to your computer and use it in GitHub Desktop.
Self executing Snowflakes as a JS module
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
import Snowflakes from 'https://cdn.skypack.dev/magic-snowflakes'; | |
// always run | |
new Snowflakes(); | |
// OR use date | |
// month in JS dates are zero-based | |
const currentMonth = new Date().getMonth() + 1; | |
const currentDay = new Date().getDate(); | |
// run from december 6th to january 15th | |
const isOkForDecember = currentMonth === 12 && currentDay >= 6; | |
const isOkForJanuary = currentMonth === 1 && currentDay <= 15; | |
if (isOkForDecember || isOkForJanuary ) { | |
new Snowflakes(); | |
} |
Yes that is because of the cache, search how disable the cache in your browser (e.g. in google chrome you can press F12 and then go to Network tab and select "Disable cache")
Hello all, glad to see that this is still used. I updated the gist to add date checks so the snowflakes can be scheduled one in code for those that want to set this and forget.
Perfect! Will update the code now forsure.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So here is my disable snow automation and weird, it seems to have worked and changed the file name but for some reason the snow still shows on my dashboard....
**EDIT: I think clearing the cache fixed it lol, but only on the HA app, still won't go away on the web but I assume its a different caching issue there.