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

                    @schlachtkreuzer6
                    The way you do it is the way it should be.
                    BUT i also cannot get it to work like this.

                    please try following:
                    Open config/config.js and remove

                    "config": {
                    		"remoteFile": "compliments.json"
                    	}
                    

                    Then open your compliments.js and check:

                    defaults: {
                    		updateInterval: 30000,
                    		remoteFile: null,
                    		fadeSpeed: 4000
                    	},
                    

                    change remoteFile to a useable name:

                    defaults: {
                    		updateInterval: 30000,
                    		remoteFile: "~/path to your/compliments.json",
                    		fadeSpeed: 4000
                    	},
                    

                    then restart MM (or restart the PI)

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

                      @DvdEnde i think my mirror has it´s own brain ^^ so i changed it like your post above. but MM just showing the default compliments. I don´t know whats wrong, but i think i will rebuild MM from the ground.

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

                        #@schlachtkreuzer6
                        If MM is showing the default compliments, where are they?
                        Please post the complete defaults from your compliments.js AND
                        the complete part of the json for compliments from your config.js.

                        also post your jsonfile where to get your custom compliments.

                        maybe we all misunderstand you?

                        schlachtkreuzer6S 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