I made an browser userscript to automatically activate scene when I watch Netflix

Hello, I am new to this community. And I like to share my greasemonkey script.

I usually watch movies not on smart TV, But I watch on Netflix, Plex, Watcha, Disney+ using my PC
So I wanted to make it automatically detect when I play movie/drama on browser, and use it as trigger to activate scene.

My scenario is like this:

  • Fullscreen on && Playing → Activate dark room
  • Fullscreen, but paused →Turn on mood light to help break time (go to toilet, take snacks, …)
  • Leave fullscreen →Turn back on main lights. movie time is done

Watch in action: Home assistant + Greasemonkey user script - YouTube

Here is my script: