MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Change color scheme depending on sunset / rise... How to tackle this?



  • Hi everybody!

    I currently have an event on my local MQTT server which provides me with the event that sun has risen or has set. This has different consequences around my house, specifically when the sun sets: curtains go down, ambiental lights go on (this last one obviously depending on whether we are home or not), staircase gets illuminated, etc.

    I have a magic monitor (on display here) which I want it to be coordinated as well: whenever the sun sets, the theme should set to be a dark theme, otherwise during the day it should be a white(ish) theme.

    I have currently overwritten some values in my CSS so that during the majority of the day it displays the light theme, but now I would like to go a step further and implement this so that after the sun sets, the screen is no longer so bright.

    Now comes my question: how would you begin to do this? Has anybody already done this before? Can I use some existing implementation to read out MQTT and perform an operation based on such an event?

    I can program comfortably (actually pretty new to nodejs!) but I’m just curious as to where to begin. Hopefully you can help me more.

    Thanks and greetings.