MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

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



  • Hello everybody
    I have the MM 2.7 update installed now the Hover module does not respond to the inputs. Can someone help me
    Thank you



  • @Skorpionbird did u npm install in the MagicMirror folder, and in each module that has a package.json?



  • @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)



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



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



  • @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…



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



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



  • @sdetweil i edit the file.