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 12.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

      I am greedy. I want what I should not ask.

      It is updating just fine.

      What is not updating is when I use multiple modules by copy folder, rename folder\js file and module name inside. I even attempted to change some of the vars to emulate a new module to no success.

      Would like to have 3 gif maps in cycle for City, State\Regional and National weather radar.

      Have a similar problem with how to scale MMM-GoogleMapsTraffic, but that is a whole more complex module it seams.

      At least I can work with one and maybe schedule them to work when there is an interest in that level of radar detail.

      1 Reply Last reply Reply Quote 0
      • M Offline
        majdzik84 @ninjabreadman
        last edited by

        @ninjabreadman Could you please explain to the novice where to insert the code?

        ... // 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);
        

        in which file?
        I want the camera snapshot to have a time stamp because without it the same photo is still there and I want to use it in the alert module

        You wrote in a different topic

        @chef The POST request isn’t sending it an image, it’s sending the URL to the image (e.g. http://192.168.2.18:9920/security/values/2). The problem is, it already has a cached copy of that image. I suggest you append a timestamp to trick electron into re-fetching the same image/resource.
        
        You want to pass it a URL-encoded value, so use %3F as ? and just append your timestamp, like so:
        
        http://192.168.2.48:8080/api/v1/modules/alert/show_ALERT?timer=10500&imageUrl=http://192.168.2.18:9920/security/values/2%3F
        {INSERT TIMESTAMP HERE}&imageHeight=220px
        

        I will be grateful for any help because I have been fighting for several hours.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @majdzik84
          last edited by sdetweil

          @majdzik84 wherever u build the url to your photo, the key is to pass some changing value, so the cache will get the new unique data.

          the trick, is to pass a parameter to the server as part of the url, but the server is not expecting any parameters, and will ignore them

          parameters on a url come after the ?
          so newurl=
          “old_url?fake_parm_name=”+millisecond_timestamp

          moment().valueOf() will return the always unique millisecond_timestamp value

          the name of the parm doesn’t matter as the server of the image is not expecting it, and the caching check is simple. is the url the SAME as one we already have data for

          no, get new data

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • M Offline
            majdzik84
            last edited by majdzik84

            parameters on a url come after the ?
            so newurl=
            “old_url?fake_parm_name=”+millisecond_timestamp
            
            moment().valueOf() will return the always unique millisecond_timestamp value
            

            Can you tell me exactly what I need to do to get it? I understand how this should work, but I can’t do it

            http://192.168.2.48:8080/api/v1/modules/alert/show_ALERT?timer=10500&imageUrl=http://192.168.2.18:9920/security/values/2%3F
            {INSERT TIMESTAMP HERE}&imageHeight=220px
            

            {INSERT TIMESTAMP HERE} - What should the variable I type {…} look like

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @majdzik84
              last edited by sdetweil

              @majdzik84 ok. it looks like you are using remote-control to send an alert request, which should display an image?

              is that correct?

              so the image url is

              'http://192.168.2.18:9920/security/values/2%3FimageHeight=220px%26someid='+moment().valueOf()
              

              note that I have made the imageUrl a literal and appended the timestamp

              you would still have to add the link for remote-control to the front

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • M Offline
                majdzik84
                last edited by

                @sdetweil I am using the standard alert module to use an alert with an image.

                Below is exactly my code that works fine but I can’t include a variable.

                I am sending the command from home assistant via rest_command

                http://192.168.2.200:8080/api/module/alert/showalert?message=Drzwi%20gara%C5%BCowe%20s%C4%85%20otwarte&imageUrl=https://xxx.com/local/snapshots/front.jpg&imageHeight=600px
                

                is it correct because it doesn’t work?

                http://192.168.2.200:8080/api/module/alert/showalert?message=Drzwi%20gara%C5%BCowe%20s%C4%85%20otwarte&imageHeight=600px&imageUrl=https://xxx.com/local/snapshots/front.jpg%3Fsomeid='+moment().valueOf()
                
                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @majdzik84
                  last edited by

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

                  I am sending the command from home assistant via rest_command

                  sorry, I don’t know how to make this work from home Assistant. I was making work from inside MM.

                  u could edit the Remote-Control module when it receives an alert request and append the timestamp there
                  but as u are not a coder, this will be difficult.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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