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-Random Fact

    Scheduled Pinned Locked Moved Education
    59 Posts 12 Posters 40.9k Views 11 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.
    • D Offline
      dirkie
      last edited by

      I’m getting the same issues.
      entry in config:
      {
      disabled: false,
      module: ‘MMM-rfacts’,
      position: ‘bottom_bar’
      },
      but it only shows “Ein Tatsache bekommen…”. I did “git pull” today and I am up to date.

      Any hint?

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

        @dirkie Yes…the api is strange… if you hit it too many times they will lock you out for a couple days…

        Give it time and it should work again.

        1 Reply Last reply Reply Quote 0
        • lavolp3L Offline
          lavolp3 Module Developer
          last edited by

          I am still having an Unhandled promise rejection:

          UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 13): TypeError: Cannot read property 'refs' of undefined
          

          My config is completely stripped down now as the new Readme suggests. No config entries.
          Loading message is in German which is my language.
          However translation still does not seem to work here.

          Any suggestions?

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

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

            I will look at it again tonight they may have changed the api… stay tuned.

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

              I just tested mine and it’s working fine… I reuploaded mine to make sure there are no errors in the one on Github…

              Also here is my config:

                    {
                      disabled: f,
                      module: 'MMM-rfacts',
                      position: 'top_left', 
                     },
              

              The language selection is taken directly from your language selected in the config file… I switched mine to ‘de’ and it worked fine. So what I would do if I were you is to delete it all and do the git clone thing and then run npm install in the MMM-rfacts dir …

              lavolp3L 1 Reply Last reply Reply Quote 0
              • lavolp3L Offline
                lavolp3 Module Developer @cowboysdude
                last edited by

                @cowboysdude
                Thanks dude :-), will try it out later today

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                1 Reply Last reply Reply Quote 1
                • lavolp3L Offline
                  lavolp3 Module Developer
                  last edited by

                  Hi guys.
                  I’ve tried to get this module working again and am still failing.
                  I was able to find out the following:
                  My general config is mentioning
                  language: 'de'
                  When I set this to en, the module works.
                  With language de, it does not give a translated fact.

                  Now the above mentioned “unhandled promise rejection” warning is not the problem.
                  You can solve this issue by adding a .catch() phrase after the .this in the promise part to catch and process a rejected promise.

                  Since the translate() function does not properly work, the promise gets rejected, and since there is no rejection handing in the code, we get the “unhandled rejection” warning. I’ll try to set up a solution and send a PR.

                  The translation problem with this module apparently lies in the google-translate-api.
                  I was able to console.log the error message
                  at /home/pi/MagicMirror/modules/MMM-rfacts/node_modules/google-translate-api/index.js:106:17 at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) code: 'BAD_REQUEST' }

                  This error is well known for the google-translate-api since 2018.

                  The question is:
                  Does this module work for anyone in another language? (and if yes: WHY?)

                  How to troubleshoot modules
                  MMM-soccer v2, MMM-AVStock

                  1 Reply Last reply Reply Quote 0
                  • lavolp3L Offline
                    lavolp3 Module Developer
                    last edited by lavolp3

                    Well…
                    “Eureka!”

                    Apparently the problem is solved using this hack. There seems to be an issue with the google-translate-api npm module that some users solved with a fork.
                    @cowboysdude look at it and let me know what you think.
                    If the issue/solution is confirmed a workaround would be to have a working fork installed via npm.

                    (need to get back to work now!!..)

                    How to troubleshoot modules
                    MMM-soccer v2, MMM-AVStock

                    1 Reply Last reply Reply Quote 1
                    • lavolp3L Offline
                      lavolp3 Module Developer
                      last edited by lavolp3

                      It’s odd that noone else seems to have the translation problem.

                      However, I have just pushed a PR including a promise.catch function in case translation does not work.
                      This module still only works with the “manipulated” google-translate-api" for me.

                      Love your module, @cowboysdude . Many great facts received in recent months.

                      How to troubleshoot modules
                      MMM-soccer v2, MMM-AVStock

                      1 Reply Last reply Reply Quote 0
                      • lavolp3L Offline
                        lavolp3 Module Developer @cowboysdude
                        last edited by

                        @cowboysdude
                        I’m afraid the link is broken in your module.
                        Directly visiting http://www.fayd.org/api/fact.xml redirects to a facebook page.

                        Node_helper.js returns a promise rejection because there’s no body element to be fetched.
                        Can you please check?

                        How to troubleshoot modules
                        MMM-soccer v2, MMM-AVStock

                        cowboysdudeC 2 Replies Last reply Reply Quote 0
                        • cowboysdudeC Offline
                          cowboysdude Module Developer @lavolp3
                          last edited by cowboysdude

                          @lavolp3 Thank you!! That is very interesting and I will look into that right now!!! Will let you know.

                          I looked…looks like I’ll have to rewrite parts of it and I will and repost as soon as it’s done…later tonight :)

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

                            @lavolp3 I have it working… it’ll be a day or so to upload it as I do have one very strange error that I want to correct :)

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

                              @lavolp3

                              https://github.com/cowboysdude/MMM-rfacts

                              New api, tested and working :)

                              C StoffbeuteluweS 2 Replies Last reply Reply Quote 2
                              • C Offline
                                chassain 0 @cowboysdude
                                last edited by

                                @cowboysdude hello,

                                Sorry but nothing to display after new install. Only “obtenir un fait…” (french)

                                1 Reply Last reply Reply Quote 0
                                • StoffbeuteluweS Offline
                                  Stoffbeuteluwe Project Sponsor @cowboysdude
                                  last edited by

                                  @cowboysdude Sorry nothing is showing… only (Eine Tatsache bekommen) German

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

                                    @Stoffbeuteluwe Not sure why it’s working here… so if you can PM me and I’ll have you try something to see if it’s the api or something else. Thanks

                                    C 1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      chassain 0 @cowboysdude
                                      last edited by

                                      @cowboysdude hello,

                                      what can we do to check ? thanks…i have update (latest and stable) npm and the same result

                                      1 Reply Last reply Reply Quote 0
                                      • lavolp3L Offline
                                        lavolp3 Module Developer
                                        last edited by

                                        @cowboysdude Dude you’re ignoring all the debugging!
                                        (After including debug logs) I got the response code 503 from the API

                                        [2020-04-23 10:35:54.046] [LOG]    10:35:54 <log> Wrong response code: 503 (/home/pi/MagicMirror/modules/MMM-rfacts/node_helper.js:47 Request._callback)
                                        [2020-04-23 10:35:54.054] [LOG]    10:35:54 <log> {"statusCode":503,"body":"<!DOCTYPE html>\n<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta charset=\"utf-8\">\n<title>Application Error</title>\n<script src=\"/cdn-cgi/apps/head/mRZC9wXQsm0r4xm9M3hblvWOKNw.js\"></script><style media=\"screen\">\n\t\t  html,body,iframe {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t  }\n\t\t  html,body {\n\t\t\theight: 100%;\n\t\t\toverflow: hidden;\n\t\t  }\n\t\t  iframe {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tborder: 0;\n\t\t  }\n\t\t</style>\n</head>\n<body>\n<iframe src=\"//www.herokucdn.com/error-pages/application-error.html\"></iframe>\n</body>\n</html>","headers":{"date":"Thu, 23 Apr 2020 08:35:53 GMT","content-type":"text/html; charset=utf-8","transfer-encoding":"chunked","connection":"close","set-cookie":["__cfduid=dba2fb4d60e085d460cd31721c37883191587630953; expires=Sat, 23-May-20 08:35:53 GMT; path=/; domain=.sameerkumar.website; HttpOnly; SameSite=Lax; Secure"],"cache-control":"no-cache, no-store","cf-cache-status":"DYNAMIC","expect-ct":"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"","server":"cloudflare","cf-ray":"588640f1695a0026-LHR","cf-request-id":"0247c6eadf000000267690a200000001"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"useless-facts.sameerkumar.website","port":443,"hostname":"useless-facts.sameerkumar.website","hash":null,"search":null,"query":null,"pathname":"/api","path":"/api","href":"https://useless-facts.sameerkumar.website/api"},"method":"GET","headers":{}}} (/home/pi/MagicMirror/modules/MMM-rfacts/node_helper.js:48 Request._callback)
                                        [2020-04-23 10:35:54.064] [LOG]    10:35:54 <log> null (/home/pi/MagicMirror/modules/MMM-rfacts/node_helper.js:49 Request._callback)
                                        

                                        I guess my pre-posters have a similar experience.

                                        How to troubleshoot modules
                                        MMM-soccer v2, MMM-AVStock

                                        lavolp3L 1 Reply Last reply Reply Quote 0
                                        • lavolp3L Offline
                                          lavolp3 Module Developer @lavolp3
                                          last edited by lavolp3

                                          @cowboysdude @chassain-0 @Stoffbeuteluwe
                                          Its obviously an API problem. The API page returns an Application Error.
                                          I guess we need another API.

                                          How about this one?
                                          https://uselessfacts.jsph.pl/random.json
                                          It seems to use (at least) the german source “neon”.
                                          I was actually looking for that for some time because neon has published a range of books called “useless facts”. FOund it accidentally just now.

                                          It could be implemented and then translated from the source language to the user language.
                                          If it uses all of neon’s facts there quite a lot.

                                          If you don’t want to use this source, no problem, then I’d build an own module.

                                          How to troubleshoot modules
                                          MMM-soccer v2, MMM-AVStock

                                          C 1 Reply Last reply Reply Quote 0
                                          • C Offline
                                            chassain 0 @lavolp3
                                            last edited by

                                            @lavolp3 we can use this for the moment…and see after…the modul is so fine that i can 't work without :)//how integrate this new api ?

                                            lavolp3L 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
                                            • 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