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.

    Compliments not displaying

    Scheduled Pinned Locked Moved Solved Development
    17 Posts 5 Posters 12.5k Views 5 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.
    • cowboysdudeC Offline
      cowboysdude Module Developer
      last edited by

      You guys would need to post your entire config.js file minus any KEYS you have in there…

      1 Reply Last reply Reply Quote 0
      • strawberry 3.141S Offline
        strawberry 3.141 Project Sponsor Module Developer @jin
        last edited by

        @jin you either have to escape your single quote inside the string or use double quotes

        evening: [
          'Wasn\'t the sunset beautiful?',
          'You look nice!'
        ]
        
        evening: [
          "Wasn't the sunset beautiful?",
          'You look nice!'
        ]
        

        Please create a github issue if you need help, so I can keep track

        1 Reply Last reply Reply Quote 0
        • J Offline
          jin @cowboysdude
          last edited by

          thanks for the replys guys
          @cowboysdude it still doesnt show any compliments

          /* Magic Mirror Config Sample
           
          *
           
          * By Michael Teeuw http://michaelteeuw.nl
           
          * MIT Licensed.
           */
          
          
          
          var config = {
          
          	port: 8080,
          
          	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
          
          
          	language: 'en',
          
          	timeFormat: 24,
          
          	units: 'metric',
          
          
          
          	modules: [
          
          		{
          
          			module: 'alert',
          
          		},
          
          		{
          
          			module: "updatenotification",
          
          			position: "top_bar"
          
          		},
          
          		{
          
          			module: 'clock',
          
          			position: 'top_left'
          
          		},
          
          		{
          
          			module: 'calendar',
          
          			header: 'UK Holidays',
          
          			position: 'top_left',
          
          			config: {
          
          				calendars: [
          
          					{
          
          						symbol: 'calendar-check-o ',
          
          						url: 'webcal://www.calendarlabs.com/templates/ical/UK-Holidays.ics'
          
          					},
          
          					{
          
          						url: 'https://calendar.google.com/calendar/ical/private/basic.ics'
          
          					}
          
          				]
          
          			}
          
          		},
          
          		{
          			module: 'compliments',
          			position: 'bottom_center',
          			config: {
          				updateInterval: 30000,
          				compliments: {
          					morning: [
          					'Good morning, sunshine!'
          					],
          					afternoon: [
          					'Looking good today!'
          					],
          					evening: [
          					'Wasn\'t the sunset beautiful?',
          					'You look nice!'
          					]
          				}
          			}
          		},
          
          		{
          
          			module: 'currentweather',
          
          			position: 'top_right',
          
          			config: {
          
          				location: 'New York',
          
          				locationID: '2643741',  //ID from http://www.openweathermap.org
          
          				appid: 'removed'
          
          			}
          
          		},
          
          		{
          
          			module: 'weatherforecast',
          
          			position: 'top_right',
          
          			header: 'Weather Forecast',
          
          			config: {
          
          				location: 'New York',
          
          				locationID: '2643741',  //ID from http://www.openweathermap.org
          
          				appid: 'removed'
          
          			}
          
          		},
          
          		{
          
          			module: 'newsfeed',
          
          			position: 'bottom_bar',
          
          			config: {
          
          				feeds: [
          
          					{
          
          						title: "BBC News",
          
          						url: "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml"
          
          					}
          
          				],
          
          				showSourceTitle: true,
          
          				showPublishDate: true
          
          			}
          
          		},
          
          	]
          
          
          };
          
          
          /*************** DO NOT EDIT THE LINE BELOW ***************/
          
          if (typeof module !== 'undefined') {module.exports = config;}
          
          

          this is the whole config file.

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @jin
            last edited by strawberry 3.141

            @jin the config looks good, I’m receiving the compliments with this. Can you check for errors in the electron console (npm start dev)? and the terminal?

            0_1489146784290_example.PNG

            Please create a github issue if you need help, so I can keep track

            L J 2 Replies Last reply Reply Quote 0
            • L Offline
              l1613532 @strawberry 3.141
              last edited by

              @strawberry-3.141
              This is the log file when I run: npm start dev

              0 info it worked if it ends with ok
              1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘start’, ‘dev’ ]
              2 info using npm@2.14.7
              3 info using node@v4.2.1
              4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
              5 info prestart magicmirror@2.1.0
              6 info start magicmirror@2.1.0
              7 verbose unsafe-perm in lifecycle true
              8 info magicmirror@2.1.0 Failed to exec start script
              9 verbose stack Error: magicmirror@2.1.0 start: electron js/electron.js "dev"
              9 verbose stack spawn ENOENT
              9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:17:16)
              9 verbose stack at emitTwo (events.js:87:13)
              9 verbose stack at ChildProcess.emit (events.js:172:7)
              9 verbose stack at maybeClose (internal/child_process.js:818:16)
              9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
              10 verbose pkgid magicmirror@2.1.0
              11 verbose cwd /home/pi/MagicMirror
              12 error Linux 4.4.50+
              13 error argv “/usr/local/bin/node” “/usr/local/bin/npm” “start” “dev”
              14 error node v4.2.1
              15 error npm v2.14.7
              16 error file sh
              17 error code ELIFECYCLE
              18 error errno ENOENT
              19 error syscall spawn
              20 error magicmirror@2.1.0 start: electron js/electron.js "dev"
              20 error spawn ENOENT
              21 error Failed at the magicmirror@2.1.0 start script ‘electron js/electron.js “dev”’.
              21 error This is most likely a problem with the magicmirror package,
              21 error not with npm itself.
              21 error Tell the author that this fails on your system:
              21 error electron js/electron.js “dev”
              21 error You can get their info via:
              21 error npm owner ls magicmirror
              21 error There is likely additional logging output above.
              22 verbose exit [ 1, true ]

              sorry, I’m also new to programming. Any ideas for next step?

              1 Reply Last reply Reply Quote 0
              • J Offline
                jin @strawberry 3.141
                last edited by

                @strawberry-3.141 all i get when i run npm start dev is

                > magicmirror@2.1.0 start /home/pi/MagicMirror
                >electron js/electron.js "dev"
                

                no log file or anything

                1 Reply Last reply Reply Quote 0
                • L Offline
                  l1613532
                  last edited by

                  Probably not a coincidence, but both @jin and I are using raspberry pi zero ‘W’ with midori as our browser.

                  L 1 Reply Last reply Reply Quote 0
                  • L Offline
                    l1613532 @l1613532
                    last edited by

                    and we are both running jesse lite

                    strawberry 3.141S 1 Reply Last reply Reply Quote 0
                    • strawberry 3.141S Offline
                      strawberry 3.141 Project Sponsor Module Developer @l1613532
                      last edited by

                      @l1613532 in the start method of the compliments.js file is an es6 arrow function which isn’t supported by the midori browser. But that doesn’t explain your error from the logs

                      Please create a github issue if you need help, so I can keep track

                      L 1 Reply Last reply Reply Quote 0
                      • L Offline
                        l1613532 @strawberry 3.141
                        last edited by

                        @strawberry-3.141 said in Compliments not displaying:

                        es6 arrow function

                        Can you describe this es6 arrow function at the start of compliments.js and what I can manually replace it with that will be supported by Midori?

                        1 Reply Last reply Reply Quote 0
                        • L Offline
                          l1613532
                          last edited by

                          Found the answer! Thank you to @strawberry-3-141 for pointing me in the right direction.

                          in the compliments.js file (found in /MagicMirror/modules/default/compliments folder), change:

                          	if (this.config.remoteFile != null) {
                          		this.complimentFile((response) => {
                          			this.config.compliments = JSON.parse(response);
                          		});
                          	}
                          

                          to:

                                   if (this.config.remoteFile != null) {
                                          this.complimentFile(
                                                  function(response){
                                                          this.config.compliments = JSON.parse(response);
                                          });
                                  }
                          

                          For all those using Midori browser (which appears to be the only browser which runs MM2 on Pi Zero), this will be an ongoing problem for certain modules that use es6 arrow functions. See https://github.com/MichMich/MagicMirror/issues/694 for more info.

                          strawberry 3.141S 1 Reply Last reply Reply Quote 0
                          • strawberry 3.141S Offline
                            strawberry 3.141 Project Sponsor Module Developer @l1613532
                            last edited by

                            @l1613532 this code isn’t working properly, you have to do

                            if (this.config.remoteFile != null) {
                              var self = this;
                              this.complimentFile(
                                function(response){
                                  self.config.compliments = JSON.parse(response);
                                 });
                            }
                            

                            Please create a github issue if you need help, so I can keep track

                            J 1 Reply Last reply Reply Quote 2
                            • J Offline
                              jin
                              last edited by

                              Seeing the solution after a couple of long shifts is a nice surprise.
                              Great work l1613532 and strawberry 3.141.

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                jacobmar1ey @strawberry 3.141
                                last edited by

                                @strawberry-3.141 said in Compliments not displaying:

                                @l1613532 this code isn’t working properly, you have to do

                                if (this.config.remoteFile != null) {
                                  var self = this;
                                  this.complimentFile(
                                    function(response){
                                      self.config.compliments = JSON.parse(response);
                                     });
                                }
                                

                                Tank you so much for this response. My Zero (non-W) was also suddenly not displaying compliments as well and I was trying to figure it out all week!

                                1 Reply Last reply Reply Quote 0

                                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
                                • 1 / 1
                                • First post
                                  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