Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    SOLVED Help getting remote compliments working

    Troubleshooting
    2
    12
    70
    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.
    • R
      robertybob last edited by

      Hi all, I’m really stressing myself out trying to get this to work, but I’ve no idea why it isn’t working when I think I’ve followed all instructions correctly.

      I have a very long compliments file and therefore have put it on my Github to store, I’ve pointed the config file to it but nothing is displayed on the screen at all.

      From the main MM error log:

      [2020-07-26 18:35:03.100] [ERROR]  /home/pi/MagicMirror/modules/default/compliments/compliments.js:9
         config: { 
               ^
      

      My config file:

      {
      module: 'compliments',
         config: { 
           remoteFile: 'https://github.com/robertybob/MagicMirrorConfigs/blob/master/compliments.json',
         ...
         ...
         }
      },
      
      S 2 Replies Last reply Reply Quote 0
      • S
        sdetweil @robertybob last edited by

        @robertybob the error is in the actual compliments.js file, did u edit that file?

        home/pi/MagicMirror/modules/default/compliments/compliments.js:9

        never edit the module files

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

          @robertybob u cannot access a file on GitHub like that

          R 1 Reply Last reply Reply Quote 0
          • R
            robertybob @sdetweil last edited by

            @sdetweil Oh I see, do I need to save that file within the module’s folder and point it to that?

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

              @robertybob correct

              R 1 Reply Last reply Reply Quote 0
              • R
                robertybob @sdetweil last edited by robertybob

                @sdetweil Sorry about that, I didn’t realise I wasn’t supposed to edit the .js files within the modules folders, I’ve restored the original compliments.js file.

                My code within config.js now reads:

                {
                module: 'compliments',
                position: 'middle_center',
                   config: { 
                     remoteFile: '/home/pi/MagicMirror/modules/default/compliments/remote_compliments.js'
                   }
                },
                

                however now only the default compliments are shown on the screen

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

                  @robertybob the doc says

                  remoteFile
                  

                  Path or URL (starting with http:// or https://) to a JSON file containing compliments,

                  so. the file needs either the file prefix

                  file://
                  or the http prefix, assuming the server root
                  the server root is /home/pi/MagicMirror
                  so
                  http://localhost:8080/modules/default/compliments/compliments.json

                  json(json) and JavaScript(js) are like each other, but not the same.
                  I would put your json file thru one of the online parsers to make sure it’s right, and then use the correct file extension

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

                    @robertybob actually, looking at it again, your GitHub url should work. if u put that in a browser it downloads a file

                    but u need to use the raw link
                    remoteFile:‘https://raw.githubusercontent.com/robertybob/MagicMirrorConfigs/master/compliments.json’

                    and i put it thru an online validator and the contents look good

                    R 1 Reply Last reply Reply Quote 0
                    • R
                      robertybob @sdetweil last edited by

                      @sdetweil Thank you so much! I spotted a missing comma a few minutes ago, which I’ve now corrected. The raw link works perfectly. Thank you so so much!!!

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

                        @robertybob awesome!!

                        I use this validator, just FYI.
                        https://codebeautify.org/jsonvalidator

                        R 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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy