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 96.7k 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.
    • schlachtkreuzer6S Offline
      schlachtkreuzer6 @jcorraliza
      last edited by

      @jcorraliza yeah… the only reason why i would use the remote file is the weather stuff, and obviously this feature has a bug, or we are to weak in coding ^^

      1 Reply Last reply Reply Quote 0
      • bheplerB Offline
        bhepler Module Developer
        last edited by bhepler

        Okay, I have the weather integration working. I’ll spare you the process I went through to figure it out, but the short version is that I am a worse developer than I originally suspected. The remoteFile capability works by replacing the three compliment arrays (morning, afternoon & evening). The weather integration works (sensibly, IMHO) by adding weather-specific compliments to the existing arrays.

        So in order to get them both working, you need to specify both the original arrays and the weather-specific arrays. You can delete any weather-specific arrays you wish, but you must have the morning, afternoon & evening arrays. Copy & paste this compliments.json file to your mirror and then modify accordingly.

        {
          "morning": ["Morning compliment"],
          "afternoon": ["Afternoon compliment"],
          "evening": ["Evening compliment"],
          "day_sunny" : [
            "Day Sunny Compliment 1",
            "Day Sunny Compliment 2"
          ],
          "day_cloudy" : [
            "Day Cloudy Compliment 1",
            "Day Cloudy Compliment 2"
          ],
          "cloudy" : ["Cloud 1"],
          "cloudy_windy" : ["Cloud windy"],
          "showers" : ["Showers"],
          "rain" : ["Rain"],
          "thunderstorm" : ["Thunderstorm"],
          "snow" : ["Snow"],
          "fog" : ["Fog"],
          "night_clear" : ["Night clear"],
          "night_cloudy" : ["Night Cloudy"],
          "night_showers" : ["Night showers"],
          "night_rain" : ["Night Rain"],
          "night_thunderstorm" : ["Night thunderstorm"],
          "night_snow" : ["Night Snow"],
          "night_alt_cloudy_wind": ["Night Cloudy Winds"]
        }
        

        I’m going to work on this a bit and hopefully the next release of the MirrorMirror software will be a bit more friendly. As an aside, I’ve noticed that the weather integration technique continually adds to the arrays. So the memory usage will grow and grow at whatever frequency you set the compliment refresh. This isn’t terrible, as straight text doesn’t take a whole lot of memory. But it may have unintended effects if you leave your mirror running for months at a time or if you are expecting a true randomization of the compliments you enter.

        schlachtkreuzer6S R 2 Replies Last reply Reply Quote 2
        • schlachtkreuzer6S Offline
          schlachtkreuzer6 @bhepler
          last edited by schlachtkreuzer6

          @bhepler okay a bit weird^^ anyway thank you! It worked perfecly!
          @Steff the config above :)

          1 Reply Last reply Reply Quote 0
          • R Offline
            roramirez Core Contributors @bhepler
            last edited by

            @bhepler said in remoteFile in compliments module:

            I’m going to work on this a bit and hopefully the next release of the MirrorMirror software will be a bit more friendly. As an aside, I’ve noticed that the weather integration technique continually adds to the arrays. So the memory usage will grow and grow at whatever frequency you set the compliment refresh. This isn’t terrible, as straight text doesn’t take a whole lot of memory. But it may have unintended effects if you leave your mirror running for months at a time or if you are expecting a true randomization of the compliments you enter.

            Hi, when I worked in this feature I remember was a flashing about this.

            If you can help how improved this is welcome :)

            Easy module development with MagicMirror Module Template

            J 1 Reply Last reply Reply Quote 0
            • SnilleS Offline
              Snille Module Developer
              last edited by

              Hi! I’m using a separate compliments file (for each user). I’ve noticed that when I use non english characters they are not shown correctly.
              The complement in the picture should say: “Tänk positivt”.
              Now it says:
              0_1485080075531_charaters.png

              If I don’t use a compliments file and put the compliments directly in the config, it works fine.

              What to do? :)

              Best regards Snille

              If you cant find it, make it and share it!
              Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

              strawberry 3.141S 1 Reply Last reply Reply Quote 0
              • strawberry 3.141S Offline
                strawberry 3.141 Project Sponsor Module Developer @Snille
                last edited by

                @Snille did you save the compliments file as utf8 encoded?

                Please create a github issue if you need help, so I can keep track

                SnilleS 1 Reply Last reply Reply Quote 1
                • SnilleS Offline
                  Snille Module Developer @strawberry 3.141
                  last edited by

                  @strawberry-3.141 I had not, now I did and it works! :)
                  Thank you!

                  If you cant find it, make it and share it!
                  Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jm @roramirez
                    last edited by

                    @roramirez Is there already a solution for the memory ‘bug’?

                    R 1 Reply Last reply Reply Quote 0
                    • R Offline
                      roramirez Core Contributors @jm
                      last edited by

                      @jm What memory bug? I’ve don’t touch nothing there. @bhepler said about the improvement

                      If you can help with this the Pull Requests are welcome :)

                      Easy module development with MagicMirror Module Template

                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        jm @roramirez
                        last edited by

                        @roramirez I meant this comment:

                        “As an aside, I’ve noticed that the weather integration technique continually adds to the arrays. So the memory usage will grow and grow at whatever frequency you set the compliment refresh. This isn’t terrible, as straight text doesn’t take a whole lot of memory. But it may have unintended effects”

                        I don’t know whether to call this a bug, but you get my point ;) I’m not an experienced coder whatsoever, so I doubt I might be of help, but I am always willing to test / assist.

                        strawberry 3.141S 1 Reply Last reply Reply Quote 0
                        • strawberry 3.141S Offline
                          strawberry 3.141 Project Sponsor Module Developer @jm
                          last edited by

                          @jm I can’t see that this is still happening on the current code base. Every time it tries to update an array will be generated with all possible values, after that the garbage collector will do his job and delete the array after usage.

                          Please create a github issue if you need help, so I can keep track

                          1 Reply Last reply Reply Quote 1
                          • Z Offline
                            ZtM
                            last edited by

                            Here is how I got the remote file compliments to work:

                            1. The config.js settings must name the remote file with no path:
                            		{
                            			module: 'compliments',
                            			position: 'bottom_bar',
                            			config: {
                            				remoteFile: 'compliments.json'
                            			}
                            		},        
                            

                            IMO it would be great if it were possible to put a full path the the remote file so it can be stored in the config directory.

                            1. Create a compliments.json file and be sure to put double quotes around the array names like so:
                            {
                            	"morning" : [
                            		"You're good enough, you're smart enough and doggone it, people like you!"
                            	],
                            	"afternoon" : [
                            		"Yes those jeans make you look fat."
                            	],
                            	"evening" : [
                            		"Please put on some pants."
                            	]
                            }
                            
                            
                            1. Put the remote file (compliments.json) into the ~/MagicMirror/modules/default/compliments directory.

                            2. Restart MM. It will show the default compliment (usually “Hi Sexy”) for the first interval and then will start showing compliments from the external file.

                            Hope this helps

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

                              Guys where can be mistake:
                              config.js looks like:

                              {
                              module: “compliments”,
                              position: “lower_third”,
                              config: {
                              remoteFile: “compliments.json”
                              }
                              },

                              Remote file placed in ~/MagicMirror/modules/default/compliments
                              but it still does not work.
                              I made all following above written steps and nothing - still oryginal compliments are one the mirror.
                              I have no idea what is wrong.

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

                                @Lahim

                                Your config entry looks okay. However, the curly quotes I see will cause problems. There should not be any in your config.js or your compliments.json file. This is an acceptable quote " but this “ is not. You can post your compliments.json file here (in a code block) so we can take a look at it.

                                Create a working config
                                How to add modules

                                L 1 Reply Last reply Reply Quote 0
                                • 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

                                            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
                                            • 4
                                            • 3 / 4
                                            • 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