• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

MMM-Sunrise-Sunset

Scheduled Pinned Locked Moved Utilities
44 Posts 9 Posters 15.1k Views 10 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.
  • V Offline
    vbloke Module Developer
    last edited by Oct 28, 2019, 11:57 AM

    https://github.com/prydonian/MMM-Sunrise-Sunset

    Made a fairly big update using a different API that needs a free key.
    https://ipgeolocation.io/signup.html

    It now gives you moonrise and moonset times and day length.

    1 Reply Last reply Reply Quote 0
    • H Offline
      henry2man
      last edited by Oct 28, 2019, 2:48 PM

      I tried this module but activating this causes my MM to show nothing. I had no error messages on MM logs (in my case, a docker server-only instance) and nor on my Chrome console.

      In other words it looks that the IPGeo free key expires in 1 day…

      V P 2 Replies Last reply Oct 28, 2019, 3:36 PM Reply Quote 0
      • V Offline
        vbloke Module Developer @henry2man
        last edited by vbloke Oct 28, 2019, 3:37 PM Oct 28, 2019, 3:36 PM

        @henry2man the API is limited to 1000 calls per day. It doesn’t appear to expire after a day.

        Can you post the config for the module?

        it should look like this:

            {
              module: "MMM-Sunrise-Sunset",
              position: "bottom_bar",
              config: {
        		apiKey: "API_KEY",
        		latitude: "123.123",
        		longitude: "23.456",
        		layout: "inline"
              }
            },
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          henry2man
          last edited by Oct 28, 2019, 6:56 PM

          I removed the config but seemed like yours. I followed the README from master. I’ll try again later, but also I’ve reviewed this API

          https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400&formatted=0

          It has enough information and seems to be free.

          What do you think?

          V 1 Reply Last reply Oct 28, 2019, 7:25 PM Reply Quote 0
          • V Offline
            vbloke Module Developer @henry2man
            last edited by Oct 28, 2019, 7:25 PM

            @henry2man that’s the one I was using before, but it required a lot of work to get the time in your local time zone as all times were returned as UTC.

            The new API uses your location to format the time automatically.

            H M 2 Replies Last reply Oct 29, 2019, 6:57 AM Reply Quote 0
            • H Offline
              henry2man @vbloke
              last edited by Oct 29, 2019, 6:57 AM

              @vbloke In this link there is a simple way to get a ISO 8601 into your local timezone --> https://stackoverflow.com/a/31453408

              var utcDate = '2011-06-29T16:52:48.000Z';  // ISO-8601 formatted date returned from server
              var localDate = new Date(utcDate);
              

              api.sunrise-sunset.org can return ISO 8601 dates using

              formatted=0
              

              parameter…

              If date parsing is the major issue & this solution works I think this approach is simpler. Even you can default the URL and simply configure lat/long & style (inline/list)

              Just my 2 cents…

              1 Reply Last reply Reply Quote 0
              • M Offline
                Mykle1 Project Sponsor Module Developer @vbloke
                last edited by Oct 29, 2019, 11:49 PM

                @vbloke

                This is right out of my MMM-SunRiseSet module.

                Feel free to use it if you like. :thumbsup:

                // sunrise set to local time using moment
                   var sunrise = document.createElement("div");
                   sunrise.classList.add("small", "bright", "sunrise");
                   sunrise.innerHTML = "Sunrise is at " + moment(SunRiseSet.sunrise).local().format("h:mm a") + " &nbsp &nbsp "
                + "Sunset is at " + moment(SunRiseSet.sunset).local().format("h:mm a");
                   wrapper.appendChild(sunrise);
                

                Create a working config
                How to add modules

                1 Reply Last reply Reply Quote 0
                • P Offline
                  pugsly @henry2man
                  last edited by Nov 18, 2019, 11:46 PM

                  @henry2man
                  I am having the same problem, whenever I put it in my config the display is blank.

                  S 1 Reply Last reply Nov 18, 2019, 11:47 PM Reply Quote 0
                  • S Offline
                    sdetweil @pugsly
                    last edited by Nov 18, 2019, 11:47 PM

                    @pugsly not in config… you have to edit the actual module code

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    P 1 Reply Last reply Nov 18, 2019, 11:53 PM Reply Quote 0
                    • P Offline
                      pugsly @sdetweil
                      last edited by Nov 18, 2019, 11:53 PM

                      @sdetweil Not sure I know what you mean. When I put this in my config the screen is all blank:

                          {
                              module: "MMM-Sunrise-Sunset",
                              position: "top_right",
                              header: "Sunrise",
                              config: {
                                  latitude: "39.2907",
                                  longitude: "-75.6344",
                                  apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                  layout: "inline"
                                      }
                          },
                      
                      S 2 Replies Last reply Nov 18, 2019, 11:58 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 2 / 5
                      • 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