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-NEWS problem

    Scheduled Pinned Locked Moved Utilities
    32 Posts 4 Posters 8.8k 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.
    • C Offline
      costascontis
      last edited by

      Re: MMM-News
      I use this module and its very nice.I only have 1 problem .Whenever i refresh (Ctrl+R) MM it seems that it clones every headline i see.For example if i refresh 1 time it shows the same headline twice,if i refresh 2 times it shows the same headline 3 times and so on.My config is :

      {
                              module: "MMM-News",
                              position: "bottom_bar",
                              config: {
                                       apiKey : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                       type: "horizontal",
                                       touchable: false,
                                       autoScroll: true,
                                       scrollStep: 100,
                                       scrollInterval: 1000,
                                       items: 20,
                                       drawInterval: 1000*10,
                                       query : [
                                                {
                                                 country: "gr",
                                                 className: "redTitle",
                                                 category: "entertainment",
                                                },
                                                {
                                                 country: "gr",
                                                 className: "redTitle",
                                                 category: "science",
                                                },
                                                {
                                                 country: "gr",
                                                 className: "redTitle",
                                                 category: "technology",
                                                },
                                                {
                                                 country: "gr",
                                                 className: "redTitle",
                                                 category: "health",
                                                },
                                               ],
                                      },
                      },
      
      ? 1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User @costascontis
        last edited by A Former User

        @costascontis
        Usually MM doesn’t need to be REFRESHED by user.
        Whenever it refreshed, your sources query to get news would be transferred to Reader newly, So Articles are accumulated.
        Anyway, The refreshing of MM is really needed for your real usage?

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

          thnx for your answer ,yes i need to refresh mm hourly just to keep some modules keep working/updating.I thought it was a good idea so i schedule a refresh every hour using the mmm-modulescheduler.The only hiccap i have is with news module that multiplying the headlines with every refresh.I now using the default news feed that is working fine but MMM-NEWS is way better.I wish there was a fix for that.

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            stuartiannaylor
            last edited by

            Not sure about ctrl+r as think that is just refresh, if you do a ctrl+F5 it does a refresh that ignores cache so its pulled as if a new browser launch.

            I have loaded and ctrl+F5 seems to work for me.
            Dunno have a look at https://forum.magicmirror.builders/topic/9805/magicmirror-screen-goes-black/11

            As just finished a bit of a write up on a guide that might help

            https://github.com/StuartIanNaylor/MagicMirror-Install-Guide-Raspberry-0-to-3/tree/master/Magic Monitor

            PS .
            Add this into your css/custom.css

            #NEWS .articleImage {
                filter: grayscale(100%);
            }
            

            Top tip from eouia

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

              @costascontis still want to understand why u need browser refresh page. MM is designed to NOT need to do that.

              What modules don’t update properly?
              Mine runs days and days without touching it.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • S Offline
                stuartiannaylor
                last edited by stuartiannaylor

                Guess it depends on what Pi you have, as can not say for 2/3 installs with electron.

                I have refresh (ctrl+F5) auto from detecting the ‘Ready to go! Please point your browser to:’ of PM2 so on config change as soon as MagicMirror is ready Chromium does a refresh.
                I also have a chromium log script to catch errors and provide the same but since the introduction to MagicMirror I seem to have an obsession with tinkering with it.
                So if i manage to get a mirror up and running for several days I guess I could capture those errors and just do a refresh only on disconnection or error.
                But noticed when I was putting together various modules that F5 refresh would sort of jam up after a while but ctrl+F5 doesn’t and is always like a clean start without having to reload the browser.

                Haven’t tried P2/3 yet have one on my desk so will have to give electron a go.
                All I know is that with chromium the server & browser become not connected and watchdog only restarts the server whilst the browser just sits as it was.
                Its why I did the simple monitor scripts as now on a restart or config change Chromium & Server are always in sync.

                So it might be the Pi version with no official support for Pi0/1 which I think is a shame as with the monitor scripts I have it seems to work great, so wondering why.
                I am sort of having a short love affair with the form factor and price of the Zero and on a relatively low load project like this it works quite well.
                In fact I am lying about the Pi2/3 as actually its a banana Pi zero same format practically no support but armv7.
                Its on my desk because I2C has me completely scratching my head and the banana is twisting my melon.
                Love the form factor though and why I think you should support as the Zero is cool and cheap.

                I do agree that the modules should work and it should be that way round, but from short outages to plethora of problems I can not see why you shouldn’t refresh?
                Guess its just not the supported way but not sure what the problem is with refresh as long as you do a hard refresh not a soft one.
                https://www.getfilecloud.com/blog/2015/03/tech-tip-how-to-do-hard-refresh-in-browsers/#.XHcXXIj7SUk

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

                  @stuartiannaylor folks that have these unexpected problems, use tools to shutdown and restart MM altogether… pm2 is one of those tools, used usually with cron (scheduling tool on linux)

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @sdetweil Seems a bit of a over kill when node restart and browser hard refresh is a matter of seconds and does exactly the same. Who wants this constantly full restart thing on the wall, on the pie zero on server restart I get no white screen at all stays as back ground and maybe 10 secs to fill again with content so for Pi2/3 you could blink and miss it.

                    I will prob have some further system log monitor actions but the pi watchdog will force a restart if seizes.

                    Cron is a really bad way to do it as it quite simple to get a notification exactly when its ready and also not just do it on a time loop when its not so you end up with the horrid white chromium refresh screen.

                    Tail and log monitoring is where linux excels.

                    ( tail -f -n0 ~/.pm2/logs/MagicMirror-out.log & ) | grep -q 'Ready to go! Please point your browser to:'
                    sh xdotool.sh
                    

                    Thats it job done.

                    PM2 only tests that MagicMirror is loaded and running as ‘Ready to go! Please point your browser to:’ comes on my lowly zero quite a bit after PM2 says MagicMirror is running.

                    Also as I say with when the browser and server (Magic Mirror) become disconnected they stay that way with Pi0/1 Electron will launch again but actually its not necessary as all that is needed is a hard refresh.

                    You can test this on a Pi2/3 with the setup I did for zero but it will work for 2/3 and also uses Stretch lite which has always confused me why the relatively pointless desktop load is used for a mirror.
                    Just change three lines and use chromium instead if you follow https://github.com/StuartIanNaylor/MagicMirror-Install-Guide-Raspberry-0-to-3

                    Really electron / server should be 2 PM2 processes as this would work more seamlessly as its an assumption but electron is just Chromium in a java wrapper with the selenium webdrivers so expecting it takes time to reload after being killed and likely that it wasn’t really required.
                    When this Banana stops twisting my melon as if I can not get I2C running on it then its destined for the bin, but if I do I will have look if I am wrong about the speed of killing electron each timeinstead of just doing a hard refresh.
                    As of course you can do a refresh as long as its a hard refresh ctrl+F5 and not ctrl+r or F5.
                    https://www.getfilecloud.com/blog/2015/03/tech-tip-how-to-do-hard-refresh-in-browsers/#.XHcXXIj7SUk

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User
                      last edited by A Former User

                      REFRESHING MM, not RESTARTING could make problems on many modules(including mines.). Regardless some modules would be not affected, but some would.

                      It depends on design of module structure. I do some tricks on DOM_OBJECTS_CREATED as a signal for ready of working. When MM is started and be ready for all DOM being prepared, that notification is emitted. Only one time emittance of that notification is expected during execution, not twice or more. But REFRESHING will break that agreement.

                      When MM Front is refreshed, MM modules would be restarted but some background-procedures (like node_helper.js or related background external scripts) are not killed or restarted properly. Because, many of them are not designed to be REFRESHED.
                      REFRESHING is some kind of interrupt from User. It couldn’t be predicted or postponed by condition. so, cannot be done killing or restarting process gracefully and safely.

                      So, It’s better not to REFRESH. RESTART MM instead.

                      S 2 Replies Last reply Reply Quote 0
                      • C Offline
                        costascontis
                        last edited by

                        ok i get it now thank you @Sean .I resolved all the problems i had with my modules except MMM-NEST-STATUS,so i dont need to refresh any more.Thanx again for the explanation.

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          stuartiannaylor @Guest
                          last edited by stuartiannaylor

                          @sean Your Module is being restarted as the server is reset.
                          If your module causes problems with hard refreshes then its non compatible with any browser as when a browser cache is cleared its cleared.
                          If refreshing after that causes problems then its bad programming with your module.
                          Its doesn’t cause problems with a hard refresh though as the cache is cleared, there is no dom as it starts a fresh and the page its pulled in as if the browser had just been started.

                          Do you understand the difference between a hard refresh and soft refresh?
                          Name your module and I will tell you if its causes problems when hard refreshed?

                          ? 1 Reply Last reply Reply Quote 0
                          • ? Offline
                            A Former User @stuartiannaylor
                            last edited by

                            @stuartiannaylor
                            No cache related problem. I’m saying background process.
                            Let’s assume node_helper.js hosts some external python script for its job. The script might be started on start(). In that case, REFRESHING doesn’t affect any harm side-effect to the script because it is already running on.
                            But if the script needs to be executed with some data of runtime after module starts, you cannot put that script execution in start(). That script should be executed by socketNotification somewhere.
                            REFRESHING makes that socketNotification transferring several times without any preparation. You cannot kill the background python script to restart it gracefully before User’s REFRESHING by force.

                            Of course, Developer can make codes to avoid this by checking current running script. but why? MM is not designed to be refreshed by user. (nonetheless whether it is possible or not)

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              stuartiannaylor @Guest
                              last edited by stuartiannaylor

                              @sean Look I am using many modules and hard refreshing with zero problems.
                              Tell me what your module is and what it is supposed to do under a hard refresh and what error it will cause.
                              I already know the answer none, but hey will test it and see.

                              Every module I install on config change auto restarts the server which takes seconds. The connection between browser and server is broken.
                              Browser waits for server to say hey port 8080 is ready then browser hard refreshes.
                              It takes 10 - 20 seconds 10 for server and the browser still holds the last screen then on ready hard refresh, browser dumps its cache and its the same as first time connection to the site.
                              Yes you can hard refresh and its vastly quicker than killing a browser for absolutely no apparent reason apart some misunderstanding of actual use.
                              Its vastly faster than killing and reloading the browser and its seemless without any horrid white screens oh awe snap or whatever it says.
                              Install my guide on a Pi and watch it do as I am trying to say.

                              https://github.com/StuartIanNaylor/MagicMirror-Install-Guide-Raspberry-0-to-3

                              ? 1 Reply Last reply Reply Quote 0
                              • ? Offline
                                A Former User @stuartiannaylor
                                last edited by A Former User

                                @stuartiannaylor
                                First I can’t understand why are you teaching me about usage. :D I’m not the who is trying any HARD or SOFT refreshing.

                                I believe you are using many modules without problem. But I’m also developing above 30+ MM modules for this community for some years. :D

                                I already know WHAT ERROR some of my modules might have when MM is refreshed. And know also it is just caused by its design. I’m saying just some modules could not be working due to its design when a user refreshes MM by force.

                                S 1 Reply Last reply Reply Quote 0
                                • S Offline
                                  stuartiannaylor @Guest
                                  last edited by stuartiannaylor

                                  @sean Just say what it is and which module and I will test it and prove either you or I are right.

                                  Its that simple as every module I install when I click save on config.js I never need to kill my browser and have gone through 5 to 10 modules at least without trouble and without restart.
                                  Just say which modules and lets test to see who is mistaken?

                                  Browsers are stateless and if the server has been reset and the browser drops its cache its the same as running new.

                                  ? 1 Reply Last reply Reply Quote 0
                                  • ? Offline
                                    A Former User @stuartiannaylor
                                    last edited by

                                    @stuartiannaylor
                                    I think this is very meaningless argues.
                                    Anyway, This thread is posted by @costascontis originally. He had a problem with MMM-News whenever he does screen refreshing with Ctrl+R. And as a creator of this module, I answered this module is not designed for that unexpected action. That’s all.
                                    So, See that module and explain me anything what you want.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      stuartiannaylor @Guest
                                      last edited by stuartiannaylor

                                      @sean ctrl+r is a soft refresh not a hard refresh and it retains the cache.

                                      Its only piontless because for some reason you will not simply state the modules you know have problems with hard refreshes.

                                      Needs to be ctrl+F5 with chromium or whatever the shortcut key for hard refresh is.

                                      ? 1 Reply Last reply Reply Quote 0
                                      • ? Offline
                                        A Former User @stuartiannaylor
                                        last edited by

                                        @stuartiannaylor
                                        I’M NOT THE WHO HAS PROBLEM WITH REFRESHING. @costascontis is the one who ask this things. So you seems to be speaking to wrong person.

                                        1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          stuartiannaylor @Guest
                                          last edited by stuartiannaylor

                                          @sean said in MMM-NEWS problem:

                                          REFRESHING MM, not RESTARTING could make problems on many modules(including mines.). Regardless some modules would be not affected, but some would.

                                          It depends on design of module structure. I do some tricks on DOM_OBJECTS_CREATED as a signal for ready of working. When MM is started and be ready for all DOM being prepared, that notification is emitted. Only one time emittance of that notification is expected during execution, not twice or more. But REFRESHING will break that agreement.

                                          When MM Front is refreshed, MM modules would be restarted but some background-procedures (like node_helper.js or related background external scripts) are not killed or restarted properly. Because, many of them are not designed to be REFRESHED.
                                          REFRESHING is some kind of interrupt from User. It couldn’t be predicted or postponed by condition. so, cannot be done killing or restarting process gracefully and safely.

                                          So, It’s better not to REFRESH. RESTART MM instead.

                                          I am replying to that which just isn’t true.
                                          So when refreshing always do a hard refresh which on Chromium is ctrl+F5 pretty sure ctrl+r is the same as F5 and a soft refresh where it keeps the cache.

                                          ? 1 Reply Last reply Reply Quote 0
                                          • ? Offline
                                            A Former User @stuartiannaylor
                                            last edited by A Former User

                                            @stuartiannaylor
                                            THIS IS THE MODULE I’VE CREATED!! So I know what happens whenever @costascontis does Ctrl+R.

                                            Anyway, this module will be newly getting the source to aggregate when it is refreshed (Hard or Normal whatever). And the reason is I’ve made so because I didn’t expect User doing refresh MM by manually. That is not related with any cache or any refresh mechanism at all. I JUST MADE THIS MODULE TO ACT SO BECAUSE I HAVEN’T EXPECTED SOMEONE REFRESH IT BY FORCE.

                                            Back to the MMM-News,
                                            Even whatever Hard refresh(Ctrl+F5) or Normal refresh(F5), This module will be accumulate the sources and show articles duplicately.(Because I made so). So I told @costascontis to RESTART instead REFRESH.

                                            So now, What isn’t true as you said?

                                            S 2 Replies Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 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