Read the statement by Michael Teeuw here.
remoteFile in compliments module
-
@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…
-
@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)
-
@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.
-
#@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?