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 module has stopped working

    Scheduled Pinned Locked Moved Solved Troubleshooting
    16 Posts 2 Posters 676 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.
    • G Offline
      geekhouri
      last edited by

      I recently noticed the compliments are no longer showing up on my MM. I have tried troubleshooting, checking for updates etc… but cannot seem to contain the issue. My config and compliments.js is listed below:

                      {
                              module: "compliments",
                              position: "top_bar"
                      },
      
      
      /* MagicMirror²
       * Module: Compliments
       *
       * By Michael Teeuw https://michaelteeuw.nl
       * MIT Licensed.
       */
      Module.register("compliments", {
              // Module config defaults.
              defaults: {
                      compliments: {
                              anytime: ["Be Smart, Be Kind, Be Like Jesus!"],
                              morning: ["Good morning!", "Enjoy your day!", "How was your sleep?"],
                              afternoon: ["How was School?", "Finish Your homework?", "Looking good today!"],
                              evening: ["Sweet Dreams", "You look nice!", "Ready for Bed"],
                             
                      },
                      updateInterval: 30000,
                      remoteFile: null,
                      fadeSpeed: 4000,
                      morningStartTime: 3,
                      morningEndTime: 12,
                      afternoonStartTime: 12,
                      afternoonEndTime: 17,
                      random: true
              },
              lastIndexUsed: -1,
              // Set currentweather from module
              currentWeatherType: "",
      
              // Define required scripts.
              getScripts () {
                      return ["moment.js"];
              },
      
              // Define start sequence.
              async start () {
                      Log.info(`Starting module: ${this.name}`);
      
                      this.lastComplimentIndex = -1;
      
                      if (this.config.remoteFile !== null) {
                              const response = await this.loadComplimentFile();
                              this.config.compliments = JSON.parse(response);
                              this.updateDom();
                      }
      
                      // Schedule update timer.
                      setInterval(() => {
                              this.updateDom(this.config.fadeSpeed);
                      }, this.config.updateInterval);
              },
      
              /**
               * Generate a random index for a list of compliments.
               * @param {string[]} compliments Array with compliments.
               * @returns {number} a random index of given array
               */
              randomIndex (compliments) {
                      if (compliments.length === 1) {
                              return 0;
                      }
      
                      const generate = function () {
                              return Math.floor(Math.random() * compliments.length);
                      };
      
                      let complimentIndex = generate();
      
                      while (complimentIndex === this.lastComplimentIndex) {
                              complimentIndex = generate();
                      }
      
                      this.lastComplimentIndex = complimentIndex;
      
                      return complimentIndex;
              },
      
      

      PM2 Logs as follows:

      /home/88888/.pm2/logs/mm-error.log last 15 lines:
      0|mm       | [15270:0123/174828.158857:ERROR:connection.cc(46)] X connection error received.
      0|mm       | [15270:0123/174828.160623:ERROR:connection.cc(46)] X connection error received.
      0|mm       | /home/88888/MagicMirror/mm.sh: line 1: cd: ./MagicMirror: No such file or directory
      0|mm       | Warning: vkCreateInstance: Found no drivers!
      0|mm       | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
      0|mm       |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
      0|mm       |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
      0|mm       |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
      0|mm       |     at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
      0|mm       |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)
      
      

      Thanks in advance

      S 1 Reply Last reply Reply Quote 0
      • G Offline
        geekhouri @sdetweil
        last edited by

        @sdetweil said in Compliments module has stopped working:

        git checkout modules/default/compliments/compliments.js

        And that has fixed it… very strange. Thanks @sdetweil

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @geekhouri
          last edited by

          @geekhouri 1st. you never edit our files.

          all config goes in config.js
          just because we arent showing all the config in the starter config.js doesn’t change this

          every module has the same general layout

          {
            module: name,
             position: somewhere,
             config:{   // if needed to add or override the defaults for this module
                  xxx:yhyy,     module specific config properties
                   qqw:700
             }
          }
          

          next, what is the mm.sh error?, show me that file

          the Vulcan errors are a noise bug in electron we cannot hide.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          G 1 Reply Last reply Reply Quote 0
          • G Offline
            geekhouri @sdetweil
            last edited by

            @sdetweil thanks for your reply. Just to be clear you mean i should not edit the compliments.js file and any configs should be in the config.js file (Sorry probably a newbie question but im still learning)

            The mm.sh code is listed below:

            cd ./MagicMirror
            DISPLAY=:0 npm start
            
            

            I hope this is what you are after.

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @geekhouri
              last edited by sdetweil

              @geekhouri the mm.sh should be
              cd ~/MagicMirror

              ~ means logged on users home folder

              config.js, yes

              {
                   module:"compliments",
                   position:"....."
                    config:{
                         compliments:   your compliments config {.. }
                    }
              }
              

              the system design is
              whatever is in config.js, overrides/replaces what is defined in the module defaults section

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              G 1 Reply Last reply Reply Quote 0
              • G Offline
                geekhouri @sdetweil
                last edited by

                @sdetweil thanks for your feedback, i have updated my config.js file but now i run into the config file error and MM does not load. Code is below as is the error after running config: check

                                {
                                        module: "compliments",
                                        position: "top_bar"
                                        config: {
                                         compliments: {
                                                 anytime: ["Be Smart, Be Kind, Be Like Jesus!"],
                                                morning: ["Good morning!", "Enjoy your day!", "How was school"],
                                                afternoon: ["How was School?", "Finish Your homework?"],
                                                evening: ["Sweet Dreams", "You look nice!", "Ready for School"],
                                                "....-01-12": ["Happy new year!"]
                                                "....02-12": ["Happy Birthday E!"]
                                                "....03-12": ["Happy Birthday Z!"]
                                                "....05-12": ["Happy Birthday G!"]
                                                }
                                },
                

                npm run config:check

                [24.01.2024 01:07.25.065] [INFO]  Checking file...  /home/gkhouri/MagicMirror/config/config.js
                [24.01.2024 01:07.25.165] [ERROR] Your configuration file contains syntax errors :(
                [24.01.2024 01:07.25.167] [ERROR] Line 68 column 4: Parsing error: Unexpected token config
                

                Line 68 is config: { …

                Thanks again

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @geekhouri
                  last edited by sdetweil

                  @geekhouri said in Compliments module has stopped working:

                  Line 68 column 4: Parsing error: Unexpected token config

                  yes, 99% of the time that means the line before was missing a trailing comma (which means more lines coming for this item)

                  your last 4 lines of the compliments list do not have the trailing comma
                  and the position line

                  just because I didn’t include it my text above doesn’t mean it’s not required…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  G 1 Reply Last reply Reply Quote 0
                  • G Offline
                    geekhouri @sdetweil
                    last edited by

                    @sdetweil made those changes and MM is working again however i the compliments are still not visible? Any thoughts?

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @geekhouri
                      last edited by sdetweil

                      @geekhouri also missing a close } before the last one

                                      {
                                              module: "compliments",
                                              position: "top_bar",
                                              config: {
                                               compliments: {
                                                       anytime: ["Be Smart, Be Kind, Be Like Jesus!"],
                                                      morning: ["Good morning!", "Enjoy your day!", "How was school"],
                                                      afternoon: ["How was School?", "Finish Your homework?"],
                                                      evening: ["Sweet Dreams", "You look nice!", "Ready for School"],
                                                      "....-01-12": ["Happy new year!"],
                                                      "....02-12": ["Happy Birthday E!"],
                                                      "....03-12": ["Happy Birthday Z!"],
                                                      "....05-12": ["Happy Birthday G!"],
                                                      }  // end of compliments
                                            }  // end of config
                                } // end of module
                      

                      you should see the error where you start mm…

                      if using pm2, then

                      pm2 logs --lines=50
                      

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      G 1 Reply Last reply Reply Quote 0
                      • G Offline
                        geekhouri @sdetweil
                        last edited by

                        @sdetweil still nothing, here is my code in full and the pm2 logs:

                                        {
                                                module: "compliments",
                                                position: "top_bar",
                                                config: {
                                                 compliments: {
                                                         anytime: ["Be Smart, Be Kind, Be Like Jesus!"],
                                                        morning: ["Good morning!", "Enjoy your day!", "How was school"],
                                                        afternoon: ["How was School?", "Finish Your homework?"],
                                                        evening: ["Sweet Dreams", "You look nice!", "Ready for School"],
                                                        "....-01-12": ["Happy new year!"],
                                                        "....02-12": ["Happy Birthday E!"],
                                                        "....03-12": ["Happy Birthday Z!"],
                                                        "....05-12": ["Happy Birthday G!"],
                                                                } //end of compliments
                                                        } //end of config
                                        }, //end of module
                        

                        Pm2 logs as follows:

                        0|mm       |     at Object..js (node:internal/modules/cjs/loader:1326:10)
                        0|mm       |     at Module.load (node:internal/modules/cjs/loader:1126:32)
                        0|mm       |     at node:internal/modules/cjs/loader:967:12
                        0|mm       | Warning: vkCreateInstance: Found no drivers!
                        0|mm       | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
                        0|mm       |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/v                                                                                                                                                                                                                                             ulkan/VulkanError.cpp:88)
                        0|mm       |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vul                                                                                                                                                                                                                                             kan/BackendVk.cpp:458)
                        0|mm       |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:344)
                        0|mm       |     at Create (../../third_party/dawn/src/dawn/native/vulkan/Backen                                                                                                                                                                                                                                             dVk.cpp:266)
                        0|mm       |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:521)
                        0|mm       |
                        0|mm       | /home/gkhouri/MagicMirror/node_modules/electron/dist/electron exite                                                                                                                                                                                                                                             d with signal SIGINT
                        0|mm       | [24.01.2024 01:29.00.569] [ERROR] WARNING! Could not validate confi                                                                                                                                                                                                                                             g file. Starting with default configuration. Please correct syntax errors at or                                                                                                                                                                                                                                              above this line: /home/gkhouri/MagicMirror/config/config.js:68
                        0|mm       |                    config: {
                        0|mm       |                    ^^^^^^
                        0|mm       |
                        0|mm       | SyntaxError: Unexpected identifier 'config'
                        0|mm       |     at internalCompileFunction (node:internal/vm:73:18)
                        0|mm       |     at wrapSafe (node:internal/modules/cjs/loader:1185:20)
                        0|mm       |     at Module._compile (node:internal/modules/cjs/loader:1227:27)
                        0|mm       |     at Object..js (node:internal/modules/cjs/loader:1326:10)
                        0|mm       |     at Module.load (node:internal/modules/cjs/loader:1126:32)
                        0|mm       |     at node:internal/modules/cjs/loader:967:12
                        0|mm       |     at Function._load (node:electron/js2c/asar_bundle:2:13327)
                        0|mm       |     at Module.require (node:internal/modules/cjs/loader:1150:19)
                        0|mm       |     at require (node:internal/modules/cjs/helpers:121:18)
                        0|mm       |     at loadConfig (/home/gkhouri/MagicMirror/js/app.js:118:14)
                        0|mm       |     at App.start (/home/gkhouri/MagicMirror/js/app.js:248:18)
                        0|mm       |     at Object.<anonymous> (/home/gkhouri/MagicMirror/js/electron.js                                                                                                                                                                                                                                             :192:7)
                        0|mm       |     at Module._compile (node:internal/modules/cjs/loader:1271:14)
                        0|mm       |     at Object..js (node:internal/modules/cjs/loader:1326:10)
                        0|mm       |     at Module.load (node:internal/modules/cjs/loader:1126:32)
                        0|mm       |     at node:internal/modules/cjs/loader:967:12
                        0|mm       | Warning: vkCreateInstance: Found no drivers!
                        0|mm       | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
                        0|mm       |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/v                                                                                                                                                                                                                                             ulkan/VulkanError.cpp:88)
                        0|mm       |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vul                                                                                                                                                                                                                                             kan/BackendVk.cpp:458)
                        0|mm       |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:344)
                        0|mm       |     at Create (../../third_party/dawn/src/dawn/native/vulkan/Backen                                                                                                                                                                                                                                             dVk.cpp:266)
                        0|mm       |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:521)
                        0|mm       |
                        0|mm       | /home/gkhouri/MagicMirror/node_modules/electron/dist/electron exite                                                                                                                                                                                                                                             d with signal SIGINT
                        0|mm       | Warning: vkCreateInstance: Found no drivers!
                        0|mm       | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
                        0|mm       |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/v                                                                                                                                                                                                                                             ulkan/VulkanError.cpp:88)
                        0|mm       |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vul                                                                                                                                                                                                                                             kan/BackendVk.cpp:458)
                        0|mm       |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:344)
                        0|mm       |     at Create (../../third_party/dawn/src/dawn/native/vulkan/Backen                                                                                                                                                                                                                                             dVk.cpp:266)
                        0|mm       |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/Ba                                                                                                                                                                                                                                             ckendVk.cpp:521)
                        0|mm       |
                        
                        
                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @geekhouri
                          last edited by

                          @geekhouri said in Compliments module has stopped working:

                          0|mm | [24.01.2024 01:29.00.569] [ERROR] WARNING! Could not validate confi g file. Starting with default configuration. Please correct syntax errors at or above this line: /home/gkhouri/MagicMirror/config/config.js:68
                          0|mm | config: {
                          0|mm | ^^^^^^
                          0|mm |
                          0|mm | SyntaxError: Unexpected identifier ‘config’

                          I can only assume you haven’t saved the updated config… (I do that sometimes…oops)

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

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