Read the statement by Michael Teeuw here.
Changing compliments
-
MagicMirror/config/config.js is the file you want to edit.
If you edit the actual modules files (which is not recommended) then you risk breaking MM altogether.
-
@Stacy said in Changing compliments:
@lavolp3 so how do I get to the modules to change them?
All the modules get their information from the config.js cruunnerr and Mykle mentioned. You don’t need to change anything in the module folders.
If the module code is broken at the moment, you can rebuild it from – or completely replace it with – the original here if you don’t want to start over again.
This is the basic code for the compliment module to be added/changed/edited in the MagicMirror/config/config.js :
{ module: "compliments", position: "lower_third", // This can be any of the regions. // Best results in one of the middle regions like: lower_third config: { compliments: { anytime: [ "Hey!", // properties are followed by commas – most common mistake "Hello." // last property within brackets doesn't get a comma ], morning: [ "Hey!" ], evening: [ "Hey!" ] } } } // add a comma (,) if another module's config is followingSee the comments in the code. The most common mistakes are missing commas or missing brackets.
-
@doubleT So, I am in the directory MagicMirror. I opened nano to the file MagicMirror/config/config.js
I chose the config.js fileI added my city and I’d to the current weat her and weather forecast. I added some compliments as shown above.
When I tried to save I got an error writing to MagicMirror/config/config.js. no such file or directory
-
That’s the correct file.
Trysudo nano MagicMirror/config/config.jsif you haven’t used sudo, that gives you advanced rights.Did you create config.js? I have a suspicion. At the beginning, there’s no config.js, you have to create it. But there’s a sample file.
Let’s check.
You’re in the dir MagicMirror,
cd configchange the directory to config
lslist the dir contents. There should be a config.js.sample. If there is also a config.js, ignore the next step.
sudo cp config.js.sample config.jsmakes a copy of config.js.sample and creates config.js
lsshould now show both files.
sudo nano config.jsto edit the config.js -
2 cents:
If you are struggling with using the terminal (I did) then I highly recommend that you download any one of the many free text editors for code. I use notepad++ (notepadqq for linux). Using such an editor makes a world of difference when editing MM files. You navigate to the file just as you would on your Windows or Mac (by clicking through your folders) and open the file using the text editor. Make your edits. Save. Done. They color the code, making it easy to see mistakes and they keep track of your brackets and such. They should eliminate your quote problem as well.
Peace
-
This should help you. It’s a pretty damn good tutorial for getting started with your config. :-)
https://forum.magicmirror.builders/topic/4528/how-to-create-a-working-config-for-absolute-beginners
-
@doubleT First of all, many thanks to everyone helping.
I do have a config.js file, I checked using the tutorial you gave.
This time i used sudo and it atii won’t let me save, but the changes we made earlier are still in the file. They are not showing up in the MM program, though.
Curious.
-
So there’s a config and when you run the MagicMirror it says there’s a config error. And
sudo nano config.jsfrom within MagicMirror/config/ doesn’t work? Cann you go to MagicMirror/config/ and show us what it says when you put inls -l? (that’s a small letter ‘L’) which will list files with their rights/owners. -
@doubleT it does not list anything. 
-
-
@doubleT pi owns both config.js and config.js.sample
-
Weird, it sounds like there shouldn’t be a problem at all.
Do you have the possibility to edit the file externally and replace it? For example via FTP.
Btw. how do you save the file? -
@doubleT I save from the terminal with ctrl o. Have also tried ctrl x, y.
When I get to the folders through the GUI, I can change the file and save it. I have uncomment ed the calendar, and moved things around, but when I add the configure script for new compliments I get the error message need a config file. I checked it using a terminal command someone gave me here and every line that I added it did not like, even though my code was exactly like the example.
Weird. However, I am learning a lot troubleshooting this issue and I appreciate all the help.
-
I had a similar problem. It showed an error for my entire addition to the config.js. Run check:config again and pay close attention to the beginning of the output. The first error should say something about expecting a bracket of one kind and it was returned a bracket of a different kind. It will also tell you the line of the error. Now nano back into config scroll down to your addition and press ctrl + c. The bottom of your screen should give you your current line number. Find the error. Mine was a missing bracket. Fixing this error fixed the entire script. All other errors were the result of the first. Sorry if I wasn’t clear or missed something, im still a new to this too. Hope it helps.
-
@AliAS remember after locating and fixing the error to hit ctrl + o to save and ctrl + x to exit nano.
-
Another suggestion, and someone please correct me if I am wrong, you could delete the config.js file and save as or copy the config-sample.js as a new config.js file. That way you have a functioning config.js. But doing so, you would have to reconfigure all your modules. Does that sound right?
-
@AliAS said in Changing compliments:
Does that sound right?
Sure, but another idea would be to rename the non-functioning config (so you don’t lose what’s in it) and THEN make a new copy of the config.js.sample and rename it to config.js. :-)
-
@Mykle1 Okay. We finally figured it out. We made an external join file for new compliments and that worked. Thank you all SOuch for your help.
-
Well done! :-)
-
External join file? Lol, thats way outta my league.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login