Read the statement by Michael Teeuw here.
remoteFile in compliments module
-
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.
-
@DvdEnde
no, this information is wrong. And you should avoid modifying module files.
Try what I have written above, it is working fine -
@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.jsupdateInterval: 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! -
@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 thenull
value is overwritten -
@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:- the variable is not set -> this if clause fails and no remote file is loaded.
- 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.
-
@yawns
Don’t worry, i know it is basic javascript.
@strawberry-3-141
i thought so too, but it is NOTI 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
-
@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?
-
@jcorraliza post your config.js and your remotefile pls
-
@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.
-
@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…