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 44.1k 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.
    • cowboysdudeC Offline
      cowboysdude Module Developer @uros76
      last edited by cowboysdude

      @uros76 sure it is… see picture below…

      news.PNG

      Just using the stock newsfeed in MM…[I DETEST CNN but needed a quick example]
      You can then use them in the same region or put one each in different regions.
      The example is both using bottom_bar but I did try and put one in bottom_bar the other in middle_center and still works… ;)

      [Just remember IF you copy the below code and put it in your config.js it will give you an error… you have to change the quotes “” or ‘’ because they do NOT copy correctly].

      {
      			module: 'newsfeed',
      			position: 'bottom_bar',
      			config: {
      				feeds: [
      					{
      						title: "CNN",
      						url: "http://rss.cnn.com/rss/cnn_latest.rss"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true
      			}
      		},
      		{
      			module: 'newsfeed',
      			position: 'bottom_bar',
      			config: {
      				feeds: [
      					{
      						title: "New York Times",
      						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true
      			}
      		},
      
      1 Reply Last reply Reply Quote 0
      • uros76U Offline
        uros76
        last edited by

        Thanks @cowboysdude for the tips. I was more thinking of having two instances of MMM-News module because I like its ability to show a small pic. But multiple uses of MMM-News doesn’t seem to work :/.

        Instead, I combined two modules and now have two different feeds working, the second one just without a picture.

        7b2f4c86-139e-4a85-ba91-173453ddd5c7-image.png

        My magicmirror projects: https://forum.magicmirror.builders/post/79889, https://forum.magicmirror.builders/post/93241 and https://forum.magicmirror.builders/post/94586

        cowboysdudeC 1 Reply Last reply Reply Quote 0
        • cowboysdudeC Offline
          cowboysdude Module Developer @uros76
          last edited by cowboysdude

          @uros76 said in MMM-News:

          MMM-News

          Oh I see. I don’t have an api key for that so I can’t really test that one ;) I know you’re setup is not what you wanted but not really sure why running 2 of them is not working without being able to test it.

          Here’s an idea… setup up 2 of them again and when you run your mirror run it in ‘npm start dev’ mode and see if you get any errors in the console.

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

            not so easy.

            MM legacy structure doesn’t consider multiple instances of node_helper. One module should have just one node_helper and vice versa. So, the cloning instance of the module needs some manual fixing. Some simple modules could be clonable easily(like the original newsfeed module), but not this module’s case.

            Another point is, to get news individually through cloned modules(If you’ve done somehow), it will consume system resources twice. and API quota also will be consumed doubly. Hmmm. it is not so beautiful.

            A reasonable approach would be, Making a serving-slave process(which access the news API) by spawn/fork from one node_helper of the module. then other cloned modules would connect to the slave to get their own needs.

            Or make another front-end module, which would just pull data from the original module.

            Anyway, I didn’t make this module for that purpose. And under the current MM structure, to do so is not so easy.

            Finally, I’m not supporting this module anymore. So, sorry. not possible by me.

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

              Ok @Sean understand the drawbacks of MM structure and thanks for all the work on this module.
              It was just a thought if its possible. I will live with use of two modules :)

              My magicmirror projects: https://forum.magicmirror.builders/post/79889, https://forum.magicmirror.builders/post/93241 and https://forum.magicmirror.builders/post/94586

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