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.

    Scheduled restart for MM or module

    Scheduled Pinned Locked Moved Troubleshooting
    14 Posts 6 Posters 7.7k Views 6 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.
    • C Offline
      CyanKali
      last edited by

      Hi,

      I´m in the middle of building my first MM and know next to nothing about coding. Thanks to Google I came very far, but now I´m stuck.

      Here is my problem: I want to show the stream of my foscam camera to my mirror. I tried the module “MMM-ipCam” but i could not get it to work (it always returned “undefined object”). But I am able to see the stream in a browser via URL. So I got the iframe module and now the stream is shown on my mirror, yeah.

      But: The stream freezes after a few hours. Sometimes it runs for a day and a half, sometimes for only 10 hours. After restarting the mirror, all is fine again.

      This is what I already tried:

      • I copied the “update interval” section from the compliments module and inserted it in the iframe module. I thought this would fetch the stream every few minutes and solve the problem. I don’t even now if I did it right, but it did not help.

      • I looked up cron jobs and thought maybe I could start and stop the mirror every six hours. But since I know nothing about it and I did not find the right command to quit the mirror (I know start is npm start, but what would I say to quit…?) I gave up.

      Can you help me with a few lines of code that I can insert into the module or for restarting the mirror?

      O 1 Reply Last reply Reply Quote 0
      • O Offline
        onetwankyfive @CyanKali
        last edited by

        @CyanKali have you checked out MMM-iFrameReload??

        1 Reply Last reply Reply Quote 0
        • C Offline
          CyanKali
          last edited by

          Thank you so much, that was exactly what I was looking for!
          I can’t believe I did not find it with by searching, I thought I checked all the modules and forums…

          Someone added the possibility to get rid of the scrolling bars in the iframe module. I just copied the code from the iframe module and it works in the iframe reload module, too.

          I don´t want to take credit for it since I just copied it, but if it helps someone else, here is what I did:
          I added “iframe.scrolling = this.config.scrolling;” in the module file, there:

          // Override dom generator.
          getDom: function() {
          var iframe = document.createElement(“IFRAME”);
          iframe.style = “border:0”
          iframe.width = this.config.width;
          iframe.height = this.config.height;
          iframe.scrolling = this.config.scrolling;
          iframe.src = this.config.url;
          return iframe;
          },

          After that, you can set “scrolling:“no”,” in the within the module in the config file.

          Thanks again!

          1 Reply Last reply Reply Quote 1
          • C Offline
            CyanKali
            last edited by

            …me again. Unfortunately, iframe reload did not work. There seems to be an known issue with refreshing pages but I tried the suggested fixes and nothing worked:
            https://github.com/TheBogueRat/MMM-iFrameReload/issues/2?_pjax=%23js-repo-pjax-container

            The author of the module does not answer me, maybe I can get some help here? When you click on the link you see my post where I describe what I already tried.

            1 Reply Last reply Reply Quote 0
            • D Offline
              daikaiju
              last edited by

              Did you ever resolve this? I’m running into the same issue.

              1 Reply Last reply Reply Quote 0
              • C Offline
                CyanKali
                last edited by

                Unfortunately no. I am still looking for a solution. And I´m still hoping somebody might help with this issue.

                D strawberry 3.141S 2 Replies Last reply Reply Quote 0
                • D Offline
                  daikaiju @CyanKali
                  last edited by

                  @CyanKali I’m not sure why the developer didn’t update the git pull for this one.

                  I ran into every issue you did when trying to implement the “fix.”

                  1 Reply Last reply Reply Quote 0
                  • strawberry 3.141S Offline
                    strawberry 3.141 Project Sponsor Module Developer @CyanKali
                    last edited by

                    @CyanKali can you try iframe.setAttribute("timestamp", new Date().getTime()); between line 32 and 33 of the js file?

                    Please create a github issue if you need help, so I can keep track

                    D 1 Reply Last reply Reply Quote 0
                    • D Offline
                      daikaiju @strawberry 3.141
                      last edited by

                      @strawberry-3.141 This worked for me. Outstanding. Thank you.

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        CyanKali
                        last edited by yawns

                        Hi straawberry, thank you for your help!
                        So, my js file now looks like this:

                        	getDom: function() {
                        		var iframe = document.createElement("IFRAME");
                        		iframe.style = "border:0"
                        		iframe.width = this.config.width;
                        		iframe.height = this.config.height;
                        		iframe.scrolling = this.config.scrolling;
                        		iframe.src =  this.config.url;
                                        iframe.setAttribute("timestamp", new Date().getTime());
                        		iframe.id = this.config.id;
                        		return iframe;
                        

                        is that right?

                        And my congif.js now looks like this:

                        	{
                        	module: 'MMM-iFrameReload',
                        	position: 'bottom_right', // This can be any of the regions.
                        		config: {
                        		// See 'Configuration options' for more information.
                        		url: "http://MY_URL",
                        		width: "80%", // Optional. Default: 400px
                        		height: "400px", // Optional. Default: 800px
                        		scrolling:"no",
                        		refreshInterval: 60, //Optional. Default: 3600 = 1 hour
                        		animationSpeed: 4000,
                        		}
                        	},
                        

                        Is that right?

                        The stream is working right now, but I don´t see any refresh animation. I will have to wait until tomorrow to see if it reloads because most of the times it takes some hours for the stream to freeze.

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