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.

    GIF update from URL with MMM-EyeCandy

    Scheduled Pinned Locked Moved Troubleshooting
    26 Posts 5 Posters 11.5k Views 5 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.
    • J Offline
      JRWJR
      last edited by

      Weather radar is a tough thing to solve, but I stumbled across a solution if I can get a module like MM-EyeCandy to do an update pull from the URL.

      	{
              module: "MMM-EyeCandy",
              position: "bottom_right",
              config: {
                  maxWidth: "50%", // Sizes the images. Retains aspect ratio.
                  //style: "1",            // 1 - 52 or use ownImagePath to override style
                  ownImagePath: "https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif", // ex: "modules/MMM-EyeCandy/pix/YOUR_PICTURE_NAME.jpg", or internet url to image
                  //ownImagePath: "https://icons.wxug.com/data/weather-maps/radar/united-states/san-antonio-texas-region-current-radar-animation.gif",
                  updateInterval: 10 * 60 * 1000,
              }
          },
      

      It does not appear the updateInterval is working unless it is throwing the following error when isolated.

      Whoops! There was an uncaught exception…
      TypeError: Cannot read property ‘hash’ of null
      at /home/pi/MagicMirror/modules/default/updatenotification/node_helper.js:68:31
      at Git. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1482:10)
      at done (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1354:21)
      at ChildProcess. (/home/pi/MagicMirror/node_modules/simple-git/src/git.js:1379:16)
      at emitTwo (events.js:106:13)
      at ChildProcess.emit (events.js:191:7)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
      MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

      Any ideas?

      Mykle1M 2 Replies Last reply Reply Quote 0
      • Mykle1M Offline
        Mykle1 Project Sponsor Module Developer @JRWJR
        last edited by

        @JRWJR said in GIF update from URL with MMM-EyeCandy:

        https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif

        I’ll take a look at this tonight

        Create a working config
        How to add modules

        N 1 Reply Last reply Reply Quote 1
        • N Offline
          ninjabreadman @Mykle1
          last edited by

          @Mykle1 @JRWJR

          I think this should work; add the following at the bottom of the start function in MMM-EyeCandy.js:

            start: function () {
            
              ...
                
              // ADDED: Schedule update timer
              setInterval(function() {
              self.updateDom(self.config.fadeSpeed || 0); // use config.fadeSpeed or revert to zero
              }, this.config.updateInterval);
          
            }, // this was line 83
          

          Problem with config or JavaScript? Copy/paste it into JSHint.
          Check out the detailed walkthroughs on install, config, modules, etc.

          Mykle1M 1 Reply Last reply Reply Quote 3
          • Mykle1M Offline
            Mykle1 Project Sponsor Module Developer
            last edited by

            Thanks ninja. I was a little tied up last night with yesterday’s Nor’Easter slamming NYC late into the evening. If you don’t mind, I’ll just incorporate that into the module when I get home from work. :-)

            Peace!

            Create a working config
            How to add modules

            1 Reply Last reply Reply Quote 2
            • Mykle1M Offline
              Mykle1 Project Sponsor Module Developer @ninjabreadman
              last edited by

              @ninjabreadman

              Thanks again but the problem still exists. Let me explain what I’ve done so far.

              1. Added your setInterval(function().
              2. Tried to seed the url of the .gif file with a timestamp but that was rejected with a 404 error.
              3. Added a timestamp div/tag so I could check if the module was actually updating. It is.

              This url is not refreshing upon updateDom but the timestamp is.
              https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif

              I’m lost. :-/

              0_1521765022297_3.png

              Create a working config
              How to add modules

              N 1 Reply Last reply Reply Quote 1
              • N Offline
                ninjabreadman @Mykle1
                last edited by

                @Mykle1 How did you seed the url with a timestamp? When I visit https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif?1521767776, I get the image returned (not a 404).

                Problem with config or JavaScript? Copy/paste it into JSHint.
                Check out the detailed walkthroughs on install, config, modules, etc.

                Mykle1M 1 Reply Last reply Reply Quote 1
                • Mykle1M Offline
                  Mykle1 Project Sponsor Module Developer @ninjabreadman
                  last edited by

                  @ninjabreadman

                  Like this, because I need the seed to change. Feel free to tell me what I’m doing wrong. Hehe :-)

                  var getTimeStamp = new Date().getTime();
                  img.src = "https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif&seed=" + getTimeStamp;
                  pic.appendChild(img);
                  wrapper.appendChild(pic);
                  

                  Create a working config
                  How to add modules

                  N 1 Reply Last reply Reply Quote 1
                  • N Offline
                    ninjabreadman @Mykle1
                    last edited by ninjabreadman

                    @Mykle1 Yep, just needs to be a ? before the first parameter. Anything after gets appended with an &, e.g. https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif?seed=1521767776&otherseed=4846528&page=2.

                    Making your code the following:

                    ... // img creation, etc
                    var getTimeStamp = new Date().getTime();
                    img.src = "https://icons.wxug.com/data/weather-maps/radar/united-states/united-states-current-radar-animation.gif?seed=" + getTimeStamp;
                    pic.appendChild(img);
                    wrapper.appendChild(pic);
                    

                    Problem with config or JavaScript? Copy/paste it into JSHint.
                    Check out the detailed walkthroughs on install, config, modules, etc.

                    Mykle1M M 3 Replies Last reply Reply Quote 2
                    • Mykle1M Offline
                      Mykle1 Project Sponsor Module Developer @ninjabreadman
                      last edited by

                      @ninjabreadman said in GIF update from URL with MMM-EyeCandy:

                      Making your code the following:

                      That did the trick. The .gif file is refreshing to reflect the new data when it changes.

                      Thanks for the lesson. I do appreciate the help.

                      Peace!

                      Create a working config
                      How to add modules

                      1 Reply Last reply Reply Quote 1
                      • Mykle1M Offline
                        Mykle1 Project Sponsor Module Developer @JRWJR
                        last edited by Mykle1

                        @JRWJR

                        I will post the update on github shortly. Thanks to our friend, @ninjabreadman, the module now works as it should.

                        EDIT:

                        A git pull in the /MagicMirror/modules/MMM-EyeCandy folder will fix you up. Please take note of the changes to the config.js entry. Also, please take into account that the url you gave only updates itself about every 15 minutes.

                        Create a working config
                        How to add modules

                        1 Reply Last reply Reply Quote 1
                        • 1
                        • 2
                        • 3
                        • 1 / 3
                        • 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