MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Displaying modules depending on Sunrise/Sunset time

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    10 Posts 4 Posters 4.3k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cowboysdudeC Offline
      cowboysdude Module Developer
      last edited by cowboysdude

      You can go here to get free sunrise/set data:

      https://sunrise-sunset.org/api

      Then create a module that depending on time of day to display the image you want…

      Example of how I do it:
      var ev1= moment().format(“HH”); //get current hour
      var ev2 = moment(srss.sunrise).format(“HH”); //converts my free data to the format
      var ev3 = moment(srss.sunset).format(“HH”);
      var day = ‘modules/MMM-Whateveryourmoduleis/images/day.png’;
      var night = ‘modules/MMM-Whateveryourmoduleis/images/night.png’;
      Then build yourself an img like this:

      0_1542908382213_Capture.PNG

      That’ll do it.

      1 Reply Last reply Reply Quote 1
      • M Offline
        marcusjsh
        last edited by

        I’ll give it a try !
        However the two modules I’m using display pictures that are evolving everyday
        For example for the moon, the module shows the phase of the moon depending on the day we are… And the globe module shows the exposure of earth to the sun based on the time of the day as it uses pictures from satellites.

        cowboysdudeC 2 Replies Last reply Reply Quote 1
        • rudibaraniR Offline
          rudibarani Project Sponsor
          last edited by

          Maybe you could tweak mmm-suncalc to send notifications at these events. That should be easy and useful for many others as well

          1 Reply Last reply Reply Quote 1
          • rudibaraniR Offline
            rudibarani Project Sponsor
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • cowboysdudeC Offline
              cowboysdude Module Developer @marcusjsh
              last edited by

              @marcusjsh If you get stuck send me a message, happy to help!

              1 Reply Last reply Reply Quote 0
              • cowboysdudeC Offline
                cowboysdude Module Developer @marcusjsh
                last edited by

                @marcusjsh Well still doable. Does the return give you a json or xml return?

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy