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.

    remoteFile in compliments module

    Scheduled Pinned Locked Moved Troubleshooting
    71 Posts 14 Posters 88.2k Views 15 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.
    • L Offline
      Lahim @Mykle1
      last edited by Lahim

      I have “ in oryginal file so I just copied it. I also tried with ' but without luck.

      The compliments.json file looks like:

      {
          "anytime" : [
              "Dziala!"
          ],
          "morning" : [
              "Good morning, sunshine!",
              "Who needs coffee when you have your smile?",
              "Go get 'em, Tiger!"
          ],
          "afternoon" : [
              "dfadfafa",
              "dffffffff",
              "fsssss!"
          ],
          "evening" : [
              "2",
              "1",
              "3333"
          ]
      }
      

      In compliments.js

      Module.register("compliments", {
      
              // Module config defaults.
              defaults: {
                      compliments: {
                              anytime: [
                                      "Hey there sexy!"
                              ],
                              morning: [
                                      "Good morning, handsome!",
                                      "Enjoy your day!",
                                      "How was your sleep?"
                              ],
                              afternoon: [
                                      "Hello, beauty!",
                                      "You look sexy!",
                                      "Looking good today!"
                              ],
                              evening: [
                                      "Wow, you look hot!",
                                      "You look nice!",
                                      "Hi, sexy!"
                              ]
                      },
                      updateInterval: 30000,
                      remoteFile: null,
                      fadeSpeed: 4000
              },
      
      
      

      I see the “anytime” are without "
      so I also tried this in …json file but does not work.

      Mykle1M 1 Reply Last reply Reply Quote 0
      • Mykle1M Offline
        Mykle1 Project Sponsor Module Developer @Lahim
        last edited by

        @Lahim said in remoteFile in compliments module:

        so I also tried this in …json file but does not work.

        So, I copied your example compliments.json file from above and tested it. Here is my config.js entry:

        {
            disabled: false,
            module: "compliments",
            position: "lower_third",
            config: {
                updateInterval: 30000,
                fadeSpeed: 1000,
                remoteFile: "compliments.json", // this file is in the compliments module folder
        }
        },
        

        And this was the result:

        0_1513974362242_1.PNG 0_1513974370367_a.PNG 0_1513974379120_b.PNG

        So, as long as you haven’t changed anything else and your config entry is correct, and your compliments.json file is name correctly and in the compliments module folder, it should work, as it does here

        Create a working config
        How to add modules

        L 1 Reply Last reply Reply Quote 0
        • L Offline
          Lahim @Mykle1
          last edited by Lahim

          Thank you for trying and helping but I copied your setup but still the same thing.

          Does compliments.json file has to be somehow written as json file? Or I can create new text file in nano and save it as compliments.json file? Does it need any special rights?
          Can you attach your .json file here so I can download and place it in the /compliments/ folder?

          Here is list of my files in compliments folder
          0_1513976348645_prt.jpg

          Mykle1M 1 Reply Last reply Reply Quote 0
          • Mykle1M Offline
            Mykle1 Project Sponsor Module Developer @Lahim
            last edited by

            @Lahim said in remoteFile in compliments module:

            Does compliments.json file has to be somehow written as json file?

            Uhh, it MUST be saved as a .json file. It’s in the README file of compliments module.

            QUOTE:
            “This file must be straight JSON. Note that the array names need quotes around them (“morning”, “afternoon”, “evening”, “snow”, “rain”, etc.).”

            I don’t use nano if I don’t have to. I use notepad++. You don’t need the terminal to use it and it saves files in just about every file format imaginable, including JSON.

            I will post my file in a moment

            Create a working config
            How to add modules

            1 Reply Last reply Reply Quote 1
            • Mykle1M Offline
              Mykle1 Project Sponsor Module Developer
              last edited by

              You MUST save this as a json file.

              {
                  "anytime" : [
              		"You look like I need a drink!",
              		"Did Pop create the Matrix?",
              		"Why are you looking at yourself?",
              		"That gut must be embarrassing!",
              		"There's a zit on your forehead!",
                      "You're fugging ugly!"
                  ],
                  "morning" : [
                      "Good morning, Pop!",
              		"How's that dream job?",
              		"You look like shit!",
              		"Enjoy your day!",
              		"Don't work too hard!"
                  ],
                  "afternoon" : [
                      "When my Bottle Pop?",
              		"Move your fat ass today!",
              		"Take a nap!",
              		"Cowboysdude is a GURU!",
              		"Is the pool open yet?",
              		"You are not appreciated!",
              		"You need a shave!"
                  ],
                  "evening" : [
                      "Strawberry 3.141 Rocks!",
              		"What the hell are you?",
              		"You're one ugly mother fucker!",
              		"Pop is a fucking genius!",
              		"You look fat in that dress!",
              		"Did someone mention SEX?"
                  ]
              }
              

              Create a working config
              How to add modules

              1 Reply Last reply Reply Quote 1
              • Mykle1M Offline
                Mykle1 Project Sponsor Module Developer
                last edited by

                compliments.js_original

                So, you did change something in the module file? That is not recommended and it makes it very difficult for me or anyone else to troubleshoot for you

                Create a working config
                How to add modules

                1 Reply Last reply Reply Quote 0
                • L Offline
                  Lahim
                  last edited by

                  I tried to change

                  remoteFile: null,
                  

                  for remoteFile: ‘compliments.json’ previously but, as you know, did not help.
                  Now I came back to the oryginal file, saved your compliments as json file in Notepad++ as you wrote, and…
                  IT IS WORKING!!!

                  Thank you so much!!!
                  F…ck, so many time I spent tring different solutions and finaly it works.
                  One more time thank you for attention and help!
                  The module - great job!!

                  Mykle1M 1 Reply Last reply Reply Quote 0
                  • L Offline
                    Lahim
                    last edited by

                    Ok, I found where was the problem and where is the problem now.
                    Because I am using Pi0 with Midori, with oryginal file the compliments were not show on the mirror but I was able to see them thru LAN.
                    So I found the solution to change:

                    if (this.config.remoteFile != null) {
                                    this.complimentFile((response) => {
                                            this.config.compliments = JSON.parse(response);
                                    });
                            }
                    

                    to:

                             if (this.config.remoteFile != null) {
                                    this.complimentFile(
                                            function(response){
                                                    this.config.compliments = JSON.parse(response);
                                    });
                            }
                    

                    and yes, that make my compliments shown on mirror but in same time the text is only from compliments.js file.
                    So now, to see the compliments I have to copy own text to .js file :(

                    That is the problem.

                    1 Reply Last reply Reply Quote 0
                    • Mykle1M Offline
                      Mykle1 Project Sponsor Module Developer @Lahim
                      last edited by

                      @Lahim said in remoteFile in compliments module:

                      IT IS WORKING!!!
                      Thank you so much!!!

                      Fantastic! You’re welcome. :-)

                      Create a working config
                      How to add modules

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        Lahim
                        last edited by

                        Will you be able to find the solution to the problem I described above?

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