MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. sdetweil
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    S
    Offline
    • Profile
    • Following 0
    • Followers 108
    • Topics 90
    • Posts 20,796
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Module MMM-Hover dosn't work with the new MM 2.7

      @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

      posted in Troubleshooting
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @nhpunch yes if you send it that way

      this.sendSocketNotification(“BUTTON_PUSHED”,this._isPushed)

      posted in Development
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @nhpunch said in How to use the 'node_helper', 'serialport':

         if(this._isPushed==false)
      

      where is _isPushed defined or set?

      i know it is in module_name.js, but node_helper cannot see it…

      you should send that as the payload on button_pressed message

      posted in Development
      S
      sdetweil
    • RE: Module MMM-Hover dosn't work with the new MM 2.7

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

      posted in Troubleshooting
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @nhpunch said in How to use the 'node_helper', 'serialport':

      https://github.com/nhpunch/sohard

      Ok, the fundamental problem is what happens in getDom()…

      until getDom() returns this modules contribution to the single web page… that content is NOT IN the DOM… It is just in memory in your module.

      so the jquery $(button) will not work. ($ means document.) and the content is NOT IN the document… (yet)

      SO, you could change to use the non jquery

      button.addEventListener('click', ()=> {
         	
         	//$(button).on("click", function(){
         		if(self.hidden){
         		//	$(overlay).fadeIn(1000);
         		//	$(button).fadeTo(1000, 0.3);
         		//	$(text).html('OFF');
                                     Log.log("button pushed 'on' ")
         			self.hidden = false;  
         			self._isPushed = false;
         		}else{
         		//	$(overlay).fadeOut(1000);
         		//	$(button).fadeTo(1000, 1);  
         		//	$(text).html('ON');
                                     Log.log("button pushed 'off' ")
         			self.hidden = true;
         			self._isPushed = true;
         		}
         	});
         	return wrapper;
      

      but… all the data elements button, overlay and text will be long gone by the time the button is pushed.
      so you will have to redesign finding them again (document.getElementByID()… or something, a different jquery selector.)

      OR

      you can push the jquery code off into a timeout handler (wait a second or 2)…
      but you will still have to redesign how to find the button… as its data element on the stack of getDom() will be long gone.

      think of getDom() as a person taking notes… they write it down on their notepad.
      then LATER they edit a big document and add their text…

      until they complete that task, you can search thru the big document all u want, the text will NOT be there…

      when I used the sample above, the button responded…

      u know you can open the developers window (npm start dev) and select the console window,
      and messages from the module_name.js will show there

      message from the node_helper will appear in the terminal window where u issued npm start dev & (note the & at the end to allow the prompt to come back)…

      posted in Development
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @nhpunch sure. Make a GitHub repo, and let me know

      posted in Development
      S
      sdetweil
    • RE: MMM-awesome-alexa

      @Cr4z33 how does the module play audio? I had an alexa module that used mpg321, which wasn’t installed… so it never made any sound

      looks like the awesome alex debug says to test play with

      omxplayer -o alsa myAudioFile.mp3
      

      https://github.com/dolanmiu/MMM-awesome-alexa/blob/master/docs/audio-setup.md

      now that the author has one lined the source, it is hard to help as much…

      posted in Utilities
      S
      sdetweil
    • RE: Use an GoogleHome as a remote speaker for the magic mirror?

      @StefanMe you would have to have a bluetooth output device on your mirror, that can be the ‘speaker’

      https://www.raspberrypi.org/magpi/bluetooth-audio-raspberry-pi-3/

      posted in Feature Requests
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @nhpunch this.sendSocketNotification(…,…)

      from the doc

      this.sendSocketNotification(notification, payload)

      notification String - The notification identifier.
      payload AnyType - Optional. A notification payload.

      If you want to send a notification to the node_helper, use the sendSocketNotification(notification, payload). Only the node_helper of this module will receive the socket notification.

      Example:

      this.sendSocketNotification('SET_CONFIG', this.config);
      

      you’ll see in the sample that this is used twice… once by the module_name.js to send the config over to the node_helper and once by the node_helper to send a new text string to the module_name.js to display

      its also used in your module, from the first post above

        start: function () {
          Log.info("Starting module: " + this.name);
          this.sendSocketNotification('CONFIG', this.config)
        },
      
      posted in Development
      S
      sdetweil
    • RE: How to use the 'node_helper', 'serialport'

      @sdetweil you make up your own messages…

      so, you have a push button on the screen (done by module_name,js)… when push button,
      send button name and 1 to node helper… when it gets 1, it uses serial port to send to arduino.

      when u let up on button , you send 0…

      write out what you WANT the system to do… (design)

      then implement THAT design

      posted in Development
      S
      sdetweil
    • 1 / 1