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

    Scheduled Pinned Locked Moved Utilities
    55 Posts 15 Posters 51.9k Views 14 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.
    • S Offline
      sdetweil @Guest
      last edited by

      @Sean I added support in my MyCovid19 module for multiple instances… it was different, but not hard

      on all modlename.js sendSocketNotificatons, add the module identifier
      on all node_helper sendSocketNotifications, send it back

      in modulename.js , CHECK all receiveSocketNotifcation messages to see if its intended for this instance, as the sendSocketNotification from the node_helper goes to ALL modulename.js instances at once.

      then in node_helper I cached the data (as u proposed with the server instance), and for every request fordata from the modulename.js, I check to see if the data has arrived,

      if not, the 1st instance to arrive calls the api to get the data, all others block in Promise
      once the data arrives, all get resolved() with the data
      if the data is already here, then I resolve() with the data

      in my production system I have 11 charts drawn, and have 2 extra browser windows open to the MM server, so 33 charts in all, served by one node_helper all sharing one data source, and only making 1 api call for the data

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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

        @sdetweil
        I don’t want to make an argument about your success. The difficulty is always relative. :)

        As you’ve said, all cloned modules should manage their own ID by themselves. (not only for the one device but also for each clients if multi-devices are working under server-clients)
        It could not be difficult, frankly, usual web sites/applications/components are developed like that.
        But the MM… hmmm. I always consider MM would be a standalone running device. Even though there exist some server/client usecases, most of the modules are developed as standalone. Using H/W peripheral(like GPIO or mic) is an example.
        Of course, we, developers can make the module clonable from the early stage of development. But I often have a question it’s worthy.

        For an imaginary use-case of other users, should I consider to make module clonable? Always my answer for this MM was… no.
        Because;

        • I’m not using clones. If I need something similar, I would make a new module, which might be able to manage multi-views(like CALEXT2) or to share some resources.(AMK2 and HOTWORDS), but it makes things too complex. I hate this way.
        • I feel some cul-de-sac from MM legacy. MM needs to provide more friendly way to reuse modules. At this moment, not. So that’s why I haven’t considered cloning. and why I lost interest in MM.

        Anyway, to say shortly. This module is not made for that purpose. Unless modification by myself or somebody, not possible. That’s all.

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

          @Sean yes, I understand. I have made a couple this way , because the use case shows multiple instances very quickly.

          but many do not, if they are hardware constrained…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • swvalentiS Offline
            swvalenti Project Sponsor
            last edited by

            git pull and npm install says it updated packages but when I check the version in the package.json it shows 2.0.0? What am I doing wrong? Thanks

            pi@raspberrypi:~ $ cd MagicMirror 
            pi@raspberrypi:~/MagicMirror $ cd modules pi@raspberrypi:~/MagicMirror/modules $ cd MMM-News pi@raspberrypi:~/MagicMirror/modules/MMM-News $ git pull Updating 081fcb2..bff080d 
            pi@raspberrypi:~/MagicMirror/modules/MMM-News $ npm install audited 95 packages in 3.8s found 0 vulnerabilities>\
            
            1 Reply Last reply Reply Quote 0
            • swvalentiS Offline
              swvalenti Project Sponsor
              last edited by

              Anyone having an issue of news feed working then not working…just a black screen in the mirror portion position.

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

                Yes, i have this problem this week, don’t know really why.
                i have not read log for debugging it

                Next time, if i have this problem i will see what happen

                1 Reply Last reply Reply Quote 0
                • swvalentiS Offline
                  swvalenti Project Sponsor
                  last edited by

                  @Bugsounet ok thanks, let me know if I can do anything to help.

                  1 Reply Last reply Reply Quote 0
                  • swvalentiS Offline
                    swvalenti Project Sponsor
                    last edited by

                    Anything I can do in the mean time to troubleshoot to help get this resolved. It is happening now, I looked in the dev window but didn’t see any errors. I don’t know where else to look. Attached should show the news on the bottom bar but nothing there. Thanks, Scott

                    Capture.PNG

                    1 Reply Last reply Reply Quote 0
                    • swvalentiS Offline
                      swvalenti Project Sponsor
                      last edited by

                      @Bugsounet Just circling back on this…would it be easier if I created an issue on github or leave it here?

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

                        @swvalenti whos news? did u look in the console window where u started MM?

                        or pm2 logs if using pm2?

                        news and calendar use the node_helper to fetch info…

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • swvalentiS Offline
                          swvalenti Project Sponsor
                          last edited by

                          Thanks Sam, checked the pm2 logs and unbeknownst to me…they now went to a paid tier api it seems!

                          
                          1|MagicMir | [2020-11-17 16:23:16.523] [LOG]    [NEWS] Error :  https://newsapi.org/v2/top-headlines?country=us&pageSize=20&apiKey=99d1bd76c7f140f58c237d54c41ab334 result.code:You have made too many requests recently. Developer accounts are limited to 100 requests over a 24 hour period (50 requests available every 12 hours). Please upgrade to a paid plan if you need more requests.
                          
                          
                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            sdetweil @swvalenti
                            last edited by

                            @swvalenti said in MMM-News:

                            50 requests available every 12 hours

                            change the refresh rate to 15 minutes that would be 48 per 12 hours

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 0
                            • swvalentiS Offline
                              swvalenti Project Sponsor
                              last edited by

                              @sdetweil I don’t see that as an option in the config…

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

                                @swvalenti edit line 48 of node_helper.js

                                change

                                    this.scanInterval = 1000*60*10
                                

                                to this

                                    this.scanInterval = 1000*60*15
                                

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

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

                                  @sdetweil yes, it’s new they have limited request. So I will add new part of code for define interval, quickly

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

                                    Hi, I have upgraded to v2.1.2 with personal fetch interval.
                                    By default i put 30 min in default config

                                    1 Reply Last reply Reply Quote 2
                                    • swvalentiS Offline
                                      swvalenti Project Sponsor
                                      last edited by

                                      @Bugsounet thank you very much

                                      1 Reply Last reply Reply Quote 0
                                      • swvalentiS Offline
                                        swvalenti Project Sponsor
                                        last edited by

                                        @Bugsounet still getting the same error in the logs and news not displaying because of it. Below is my config. Any ideas?

                                        },
                                        		{
                                          		module: "MMM-News",
                                          		position: "bottom_bar",
                                          		config: {
                                            		apiKey : "XXXXXXXXX",
                                            		type: "horizontal",
                                            		query : [
                                              		{
                                                	sources: "fox-news, fox-sports",
                                        },
                                              {
                                                country: "us",
                                                className: "redTitle",
                                              },
                                            ],
                                        	touchable: false,
                                        	scanInterval: 1000*60*15
                                          }
                                        },
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • swvalentiS Offline
                                          swvalenti Project Sponsor
                                          last edited by

                                          Not sure what it means but says initialized with 10 query

                                          /home/pi/.pm2/logs/MagicMirror-out.log last 15 lines:
                                          1|MagicMir | [2020-11-22 18:00:23.595] [LOG]    MMM-PGA Retrieving Tounament List
                                          1|MagicMir | [2020-11-22 18:00:24.198] [LOG]    MMM-PGA retrieving Tournament Data
                                          1|MagicMir | [2020-11-22 18:05:22.126] [LOG]    Use existing calendar fetcher for url: https://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics
                                          1|MagicMir | [2020-11-22 18:05:22.134] [INFO]   Calendar-Fetcher: Broadcasting 2 events.
                                          1|MagicMir | [2020-11-22 18:05:22.391] [INFO]   Calendar-Fetcher: Broadcasting 2 events.
                                          1|MagicMir | [2020-11-22 18:05:24.044] [LOG]    MMM-PGA retrieving Tournament Data
                                          1|MagicMir | [2020-11-22 18:05:24.437] [LOG]    MMM-PGA Retrieving Tounament List
                                          1|MagicMir | [2020-11-22 18:07:49.476] [LOG]    Use existing calendar fetcher for url: https://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics
                                          1|MagicMir | [2020-11-22 18:07:49.477] [INFO]   Calendar-Fetcher: Broadcasting 2 events.
                                          1|MagicMir | [2020-11-22 18:07:49.481] [LOG]    MMM-PGA config received
                                          1|MagicMir | [2020-11-22 18:07:49.485] [LOG]    [NEWS] MMM-News Version: 2.1.2
                                          1|MagicMir | [2020-11-22 18:07:49.486] [LOG]    [NEWS] Initialized with 10 query
                                          1|MagicMir | [2020-11-22 18:07:49.720] [LOG]    MMM-PGA Retrieving Tounament List
                                          1|MagicMir | [2020-11-22 18:07:49.804] [INFO]   Calendar-Fetcher: Broadcasting 2 events.
                                          1|MagicMir | [2020-11-22 18:07:50.969] [LOG]    MMM-PGA retrieving Tournament Data
                                          
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • ? Offline
                                            A Former User
                                            last edited by A Former User

                                            limited to 100 query by day and 50 query for 12 hours

                                            It’s not me who have set this limit but it’s news api
                                            and sorry, i don’t work in news api too ! :)

                                            so now just a little calc…

                                            you have 10 query and refresh is set to 15m

                                            for one query for one hour (every 15min) => 4 query
                                            for 10 query for one hour (every 15 min) => 4*10 = 40 query

                                            in 12 hours with one query => 12 * 4 = 48 query / 50 max
                                            in 12 hours with 10 query => 12* 40 = 480 query / 50 max

                                            in 24 hours with one query => 24 * 4 => 96 query / 100 Max
                                            in 24 hours with 10 query => 24*40 => 960 query / 100 max

                                            That why you have this error… and I just calc the number of query

                                            {
                                               sources: "fox-news, fox-sports",
                                            },
                                            

                                            –> result: it take 9 query (take a lot of resource)

                                            {
                                               country: "us",
                                               className: "redTitle",
                                             },
                                            

                                            –> result: it take just one query

                                            Note: personnaly, i use only redTitle of my country
                                            Note 2: i will add soon a counter for calc if number of query is correct

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