• 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.

8kb "compliments module" works. 204kb "compliments module" fails to display. how to fix?

Scheduled Pinned Locked Moved Solved Troubleshooting
7 Posts 3 Posters 1.9k Views 2 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.
  • S Offline
    Steed
    last edited by Jan 22, 2019, 4:19 AM

    ok so the original size of the /modules/compliments/compliments.js is 8kb.
    im trying to display portions of a book. having trouble. the file is now 204kb
    everything except the book loads on the npm start command.
    how can i create 4 seprate files to call? basically i want to try and break the compliments modules 4 sections of the day into 4 files i can call that way the module will boot up… the total size of the files will be maybe 40kb each which last i checked worked i think. so maybe if i lower the amount of stuff in the actual module and just call upon separate files from the module things will work out well?

    how can i do this?

    L 1 Reply Last reply Jan 22, 2019, 10:26 AM Reply Quote 0
    • L Offline
      lavolp3 Module Developer @Steed
      last edited by Jan 22, 2019, 10:26 AM

      @steed You can outsource all data you want to show into one .json file and use day times as sections. It’s described in the readme of the module.
      E.g. I created a .json with random citations just including them all into one file in the anytime section

      {
          "anytime" : [
          
          ]
      }
      

      How to troubleshoot modules
      MMM-soccer v2, MMM-AVStock

      1 Reply Last reply Reply Quote 0
      • S Offline
        Steed
        last edited by Steed Jan 22, 2019, 4:27 PM Jan 22, 2019, 4:26 PM

        @lavolp3

        i have been trying my best but i cant seem to link the file.
        heres what i got.
        compliments.js >
        odule.register(“compliments”, {

        // Module config defaults.
        defaults: {
        	compliments: {
        		anytime: [
        			"Don't forget to laugh often, and smile always!"
        		],
        		morning: [
        			"Good morning!",
        			"Enjoy your day!",
        			"Rise and shine, the early bird gets the worm!",
        			"You are loved!",
        			"Each and every day brings it's own blessings!"
        		],
        		afternoon: [
        			"All work and no play? Must be the middle of the day!",
        			"Live, Laugh, Love!",
        			"Mirror, Mirror on the wall...",
        			"Looking good today!"
        		],
        		evening: [
        			"Another day is coming to a close!",
        			"Dinner time!",
        			"Bed time is the best time of the day!"
        		]
        	},
        	updateInterval: 30000,
        	remoteFile: "~/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json",
        	fadeSpeed: 4000,
        	morningStartTime: 3,
        	morningEndTime: 12,
        	afternoonStartTime: 12,
        	afternoonEndTime: 17
        },
        

        ‘’‘’‘’
        the program is just ignoring the .json file and doing the regular compliments.
        i have the book broken into 4 sections anytime morning afternnon and evening.

        when i delete the default compliments up there ^^^^ it says undefined. even without comments in the compliments.js the remote_compliments still isnt being called.

        i spend a lot of time putting 1590 lines of a book into quotations and stuff so i dont want to give up.

        B L 2 Replies Last reply Jan 22, 2019, 5:40 PM Reply Quote 0
        • B Offline
          bhepler Module Developer @Steed
          last edited by bhepler Jan 22, 2019, 5:43 PM Jan 22, 2019, 5:40 PM

          @steed - You should not be modifying the compliments.js file. Any compliments you wish to insert into the module should be specified in the config.js file. In your case, you want to modify the config.js file to point to your large compliments JSON file.

          Roughly:

          {
          	module: "compliments",
          	position: "lower_third",	
          	config: {
          		remoteFile:'/home/pi/bookCompliments.json'
          	}
          }
          
          1 Reply Last reply Reply Quote 2
          • L Offline
            lavolp3 Module Developer @Steed
            last edited by Jan 23, 2019, 10:10 AM

            @steed Although I think your way should have worked out if not for a small error (below), @bhepler 's advice is much better, because otherwise you will have a problem as soon as you want to update the mirror software.
            The module’s own .js files themselves are part of the git workflow, if you change them locally and are not common to using git, you’ll be in a fine mess later on and will not know what to do.
            Therefore, it’s ideal to use the config.js or custom.css for changes because they will be ignored by the git workflow.

            However in your approach you have only one small mistake

            	remoteFile: "~/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json",
            
            

            should read

            	remoteFile: "/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json",
            
            

            The “~” leads to your home/pi directory therefore it was redundant and the system was looking for /home/pi/home/pi/…

            OR just use this

            	remoteFile: "remote_compliments.json",
            
            

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            S 1 Reply Last reply Jan 23, 2019, 11:20 PM Reply Quote 1
            • S Offline
              Steed @lavolp3
              last edited by Jan 23, 2019, 11:20 PM

              @lavolp3 thanks! got it working

              1 Reply Last reply Reply Quote 0
              • B Offline
                bhepler Module Developer
                last edited by Jan 24, 2019, 2:43 AM

                Glad to hear it!

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  2/7
                  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