• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 84.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.
  • Y Offline
    yawns Moderator @DvdEnde
    last edited by Jan 8, 2017, 4:18 PM

    @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 Jan 8, 2017, 4:39 PM Reply Quote 1
    • D Offline
      DvdEnde @yawns
      last edited by DvdEnde Jan 8, 2017, 4:40 PM Jan 8, 2017, 4:39 PM

      @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!

      S S 2 Replies Last reply Jan 8, 2017, 4:48 PM Reply Quote 0
      • S Offline
        strawberry 3.141 Project Sponsor Module Developer @DvdEnde
        last edited by Jan 8, 2017, 4:48 PM

        @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
        • Y Offline
          yawns Moderator
          last edited by yawns Jan 8, 2017, 4:50 PM Jan 8, 2017, 4:48 PM

          @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 Jan 8, 2017, 4:58 PM Reply Quote 0
          • D Offline
            DvdEnde @yawns
            last edited by Jan 8, 2017, 4:58 PM

            @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 Jan 8, 2017, 6:04 PM

              @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?

              S 1 Reply Last reply Jan 8, 2017, 10:38 PM Reply Quote 0
              • S Offline
                schlachtkreuzer6 @jcorraliza
                last edited by Jan 8, 2017, 10:38 PM

                @jcorraliza post your config.js and your remotefile pls

                J 1 Reply Last reply Jan 8, 2017, 11:02 PM Reply Quote 0
                • J Offline
                  jcorraliza @schlachtkreuzer6
                  last edited by Jan 8, 2017, 11:02 PM

                  @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
                  • S Offline
                    schlachtkreuzer6 @DvdEnde
                    last edited by Jan 9, 2017, 10:59 AM

                    @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 Jan 9, 2017, 11:12 AM Reply Quote 0
                    • D Offline
                      DvdEnde @schlachtkreuzer6
                      last edited by Jan 9, 2017, 11:12 AM

                      @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)

                      S 1 Reply Last reply Jan 9, 2017, 11:31 AM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 8
                      • 3 / 8
                      3 / 8
                      • First post
                        22/71
                        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