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 90.9k 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.
    • D Offline
      DvdEnde
      last edited by DvdEnde

      Friends,

      using version 2.1.0 you must have the remoteFile within the configuration of the compliments.js.

      the file should start like this:

      defaults: {
      	updateInterval: 30000,
      	remoteFile: 'put your file here',
      	fadeSpeed: 4000
      },
      

      it is only working with a local file.

      in my config/config.js i did not change anything for compliments module.

      yawnsY 1 Reply Last reply Reply Quote 0
      • yawnsY Offline
        yawns Moderator @DvdEnde
        last edited by

        @DvdEnde
        no, this information is wrong. And you should avoid modifying module files.
        Try what I have written above, it is working fine

        D 1 Reply Last reply Reply Quote 1
        • D Offline
          DvdEnde @yawns
          last edited by DvdEnde

          @yawns Sorry but your option did not work for me.
          Also please check the original compliment.js file:
          https://github.com/MichMich/MagicMirror/blob/develop/modules/default/compliments/compliments.js
          it is standard prepared there.

          Please also check line 50:
          if (this.config.remoteFile != null) {

          At first I also thought this would be the major config file, but it is not. Its the module.
          If you console.log(this.config) it will give you an object like this. All information from the compliment.js

              updateInterval: 30000,
              remoteFile: null,
              fadeSpeed: 4000
          

          That is why i think @schlachtkreuzer6 should give this a try.
          You have also the latest version?

          I understand that modules should not be changed.

          Just trying to help.
          Please do correct me if I am wrong!

          strawberry 3.141S schlachtkreuzer6S 2 Replies Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @DvdEnde
            last edited by

            @DvdEnde the part from the config in the config.js overwrites the values in default with Object.assign()

            so when you define remoteFile in the config.js the null value is overwritten

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

            1 Reply Last reply Reply Quote 0
            • yawnsY Offline
              yawns Moderator
              last edited by yawns

              @DvdEnde Please don’t get me wrong, but this is basic javascript.

              this.config.remoteFile != null checks if the variable “remoteFile” is set in your config file. Afterwards you only have two scenarios:

              1. the variable is not set -> this if clause fails and no remote file is loaded.
              2. the variable is set to any value -> this if clause is true and the function complimentFile() is called, which tries to load the file defined in your config file, in my case “compliments.json”.

              If loading the remote file fails you see an error message in console output of your browser. Otherwise it does not produce any log.

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                DvdEnde @yawns
                last edited by

                @yawns
                Don’t worry, i know it is basic javascript.
                @strawberry-3-141
                i thought so too, but it is NOT

                I just now changed the compliment.js (and deleted the remoteFile completly from here) and added this within the config.

                My object is simple

                    fadeSpeed: 4000
                    updateInterval: 30000
                

                On line 33 console.log(this.config.remoteFile) = undefined

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jcorraliza @yawns
                  last edited by

                  @yawns OK I created a compliments_test.json file and pasted your example into it and it worked. It looks like it just doesn’t work with the currentweather objects in my compliments.json file for some reason. Do I need to nest the currentweather objects within the morning, afternoon, and evening arrays perhaps?

                  schlachtkreuzer6S 1 Reply Last reply Reply Quote 0
                  • schlachtkreuzer6S Offline
                    schlachtkreuzer6 @jcorraliza
                    last edited by

                    @jcorraliza post your config.js and your remotefile pls

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      jcorraliza @schlachtkreuzer6
                      last edited by

                      @schlachtkreuzer6 said in remoteFile in compliments module:

                      @jcorraliza post your config.js and your remotefile pls

                      Hi there, I posted them a few posts up. It works with the time of day objects, but not with the currentweather objects in my .json file. I’m using v2.1.0, dev branch, and I’m using the currentweather default module.

                      1 Reply Last reply Reply Quote 0
                      • schlachtkreuzer6S Offline
                        schlachtkreuzer6 @DvdEnde
                        last edited by

                        @DvdEnde MM is up to date and every module i git pull the latest version, nope it says it´s a invalid .json in the MM-Admin-Interface. i just can not use this config @yawns post:

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

                        if i try to start MM, it´s showing up, that the config is broken. even when i adjust it to the MM-Admin code:

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

                        I´m not in javascript or anything coding. But nothing worked for me. maybe my system is somehow broken…

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