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.

    Module MMM-Hover dosn't work with the new MM 2.7

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    9 Posts 2 Posters 1.8k 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
      Skorpionbird @sdetweil
      last edited by Skorpionbird

      @sdetweil hello yes i did mm is starting with this error:

      Whoops! There was an uncaught exception…
      TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
      at maybeCallback (fs.js:157:9)
      at Object.fs.write (fs.js:652:16)
      at Gpio.write (/home/pi/MagicMirror/modules/MMM-Hover/node_modules/onoff/onoff.js:202:6)
      at Timeout._onTimeout (/home/pi/MagicMirror/modules/MMM-Hover/node_modules/hover-nodejs/Hover.js:50:15)
      at ontimeout (timers.js:427:11)
      at tryOnTimeout (timers.js:289:5)
      at listOnTimeout (timers.js:252:5)
      at Timer.processTimers (timers.js:212:10)

      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @Skorpionbird
        last edited by sdetweil

        @Skorpionbird looks like a breaking change in onoff.js module…

        latest fs has started enforcing callback on async operations.

        onoff write needs to be fixed like read

        Gpio.prototype.read = function (callback) {
          fs.read(this.valueFd, this.readBuffer, 0, 1, 0, function (err, bytes, buf) {
            if (typeof callback === 'function') {
              if (err) {
                return callback(err);
              }
        
              callback(null, buf[0] === ONE[0] ? 1 : 0);
            }
          });
        };
        

        current write

        Gpio.prototype.write = function (value, callback) {
          var writeBuffer = value === 1 ? ONE : ZERO;
          fs.write(this.valueFd, writeBuffer, 0, writeBuffer.length, 0, callback);
        };
        

        try editing MagicMirror/node_modules/onoff/onoff.js
        and changing the Gpio.prototype.write (line 200)
        to this

        Gpio.prototype.write = function (value, callback) {
          var writeBuffer = value === 1 ? ONE : ZERO;
          fs.write(this.valueFd, writeBuffer, 0, writeBuffer.length, 0, function (err, bytes, buf) {
            if (typeof callback === 'function') {
              if (err) {
                return callback(err);
              }
        
              callback(null, bytes, buf);
            }
          });
        };
        

        I have submitted issue 150 to the onoff module on github

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • S Offline
          Skorpionbird
          last edited by

          Hi, thanks for the fast reply. I made the change, but I can only test it tonight when I’m home.

          S 1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @Skorpionbird
            last edited by sdetweil

            @Skorpionbird ok… on the issue I posted, the developer says latest onoff version should work too…

            4.1.1, hover-nodejs request 1.1.1 and got 1.2.0

            so another thing to try after this, is rename the node_modules/onoff folder to onoff-old
            then from MagicMirror folder do

            npm install onoff
            

            to get the latest

            and try running mirror again…

            there are some breaking changes in 4.1.0 and above, so its possible to cause more problems…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              @sdetweil thx for your help now it works fine. I have the old issue that the page change just on the rightslide. But this ok… when push the left button i can see that the MMM-page-indicator module change the page but it dosnt change the infos on the screen.

              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @Skorpionbird
                last edited by

                @Skorpionbird cool which solution did u use? Edit file or upgrade on off?

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  @sdetweil i edit the file.

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