Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. StacheEnthusiast
    S
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    StacheEnthusiast

    @StacheEnthusiast

    6
    Reputation
    11
    Posts
    1032
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    StacheEnthusiast Follow

    Best posts made by StacheEnthusiast

    • MMM-PIR-Sensor Guide with Edits and Updates

      I recently got the MMM-PIR-Sensor up and going and it’s working flawlessly. I wanted to give a little information as I had to parse this from different sources and some of the info is a bit dated.

      I am relatively new to pi in general so definitely point it out if something isn’t right.

      Below is a step by step for MMM-PIR-Sensor by paviro.

      Navigate to your modules folder at cd ~/MagicMirror/modules
      Execute git clone https://github.com/paviro/MMM-PIR-Sensor.git
      Navigate to cd ~/MagicMirror/modules/MMM-PIR-Sensor

      This is one area I got held up
      The guide states to perform an npm install where a dated version(2.25) of wiring-pi would be installed.
      When issuing the command gpio -v, I would get an error message “Unable to determine hardware version. I see: Hardware : BCM2835 - expecting BCM2708 or BCM2709. Please report this to project@drogon.net”.

      Instead use npm install wiring-pi inside your MMM-PIR-Sensor folder. This will install the updated version(2.44) which you can verify with gpio -v.

      Then issue command sudo usermod -a -G gpio pi
      Then sudo chmod u+s /opt/vc/bin/tvservice && sudo chmod u+s /bin/chvt

      The guide says to reboot here but after that, it still wasn’t working for me. Then I stumbled on some excellent advice from the forums here from @JamesMM with @strawberry 3.141 contributing.

      Their focus was on the node_helper.js within the module. These are their edits.

      First, rename the current file. mv node_helper.js node_helper_backup.js

      Now, create a new file called node_helper.js using sudo nano node_helper.js

      Copy and paste this code

      'use strict';
      
      /* Magic Mirror
       * Module: MMM-PIR-Sensor
       *
       * By Paul-Vincent Roll http://paulvincentroll.com
       * MIT Licensed.
       */
      
      const NodeHelper = require('node_helper');
      const Gpio = require('onoff').Gpio;
      const exec = require('child_process').exec;
      
      module.exports = NodeHelper.create({
        start: function()
      {
          this.started = false;
      },
      
        activateMonitor: function()
      {
          if (this.config.relayPIN != false)
          {
              this.relay.writeSync(this.config.relayOnState);
          }
          else if (this.config.relayPIN == false)
          {
              // Check if hdmi output is already on
              exec("/opt/vc/bin/tvservice -s").stdout.on('data', function(data) {
                  if (data.indexOf("0x120002") !== -1)
                      exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
              });
          }
      },
      
        deactivateMonitor: function()
      {
          if (this.config.relayPIN != false)
          {
              this.relay.writeSync(this.config.relayOffState);
          }
          else if (this.config.relayPIN == false)
          {
              exec("/opt/vc/bin/tvservice -o", null);
          }
      },
      
        // Subclass socketNotificationReceived received.
        socketNotificationReceived: function(notification, payload)
      {
          if (notification === 'CONFIG' && this.started == false)
          {
              const self = this;
              this.config = payload;
              self.timer = null;
              self.onState = 0;
      
              // Setup value which represent on and off
              const valueOn = this.config.invertSensorValue ? 0 : 1;
              const valueOff = this.config.invertSensorValue ? 1 : 0;
      
              //Log.info('PIR: ' + this.name);
      
              //Setup pins
              this.pir = new Gpio(this.config.sensorPIN, 'in', 'both');
      
              if (this.config.relayPIN)
              {
                  this.relay = new Gpio(this.config.relayPIN, 'out');
                  this.relay.writeSync(this.config.relayOnState);
                  exec("/opt/vc/bin/tvservice --preferred && sudo chvt 6 && sudo chvt 7", null);
              }
      
              //Detected movement
              this.pir.watch(function(err, value) {
                  if (value == 1)
                  {
                      clearTimeout(self.timer);
                      if (self.onState != 1)
                      {
                          self.sendSocketNotification("USER_PRESENCE", true);
                          if (self.config.powerSaving)
                          {
                              self.activateMonitor();
                              self.onState = 1;
                          }
                      }
                  }
                  else if (value == 0)
                  {
                      if (self.onState != 0)
                      {
                          self.timer = setTimeout(function(){
                              self.sendSocketNotification("USER_PRESENCE", false);
                              if (self.config.powerSaving)
                              {
                                  self.deactivateMonitor();
                                  self.onState = 0;
                              }
                          }, self.config.offDelay);
                      }
                  }
              });
      
              this.started = true;
      
          }
          else if (notification === 'SCREEN_WAKEUP')
          {
              this.activateMonitor();
          }
      }
      
      });
      

      This creates a new config called offDelay and it is in configurable in milliseconds.
      Reboot your pi.

      Then add the modules configuration to MM’s config.js. I used this but obviously adjust it to your own needs.

      	{
      		module: 'MMM-PIR-Sensor',
      		config: {
      			sensorPIN: 22,
      			powerSaving: true,
      			offDelay: 30000,
      		}
      	}
      

      The offDelay of 30000 is 30 seconds.

      posted in Development
      S
      StacheEnthusiast

    Latest posts made by StacheEnthusiast

    • RE: What voice related modules are available?

      @E3V3A

      Nice post idea. This should help a lot of people.

      I started my mirror project by setting up google assistant first by following this guide:
      http://www.instructables.com/id/Hands-Free-Google-Assistant-for-Raspberry-Pi/

      The guide is fantastic, there was not one hiccup with the install, and the GA works as expected. Currently, I have it running with in conjunction with MM without integration. The integration would be nice though.

      posted in General Discussion
      S
      StacheEnthusiast
    • RE: MMM-cryptocurrency side by side top bar

      @ninjabreadman
      Wow, terrific answer and thank you. I will give this a shot and post what I come up with. My attempt at setting the tr widths from custom.css was getting no where.

      posted in Troubleshooting
      S
      StacheEnthusiast
    • RE: MMM-cryptocurrency side by side top bar

      @StacheEnthusiast

      Update: I have taken the cowards way out and trimmed the currencies and duplicated the modules config into different regions of the config.js like top_left, top_center, and top_right. This has solved the issue.

      posted in Troubleshooting
      S
      StacheEnthusiast
    • MMM-cryptocurrency side by side top bar

      Currently, the currencies are displaying vertically with lots of padding. How can I alter the css to have them displaying side by side in the top bar?

      This is what it currently looks like.
      Current State

      And this is what I would like it to look like
      What I Would Like

      Any help is greatly appreciated!

      posted in Troubleshooting
      S
      StacheEnthusiast
    • RE: MMM-GoogleFit

      I’m getting an auth error, “stats error”. I’ve followed the steps and MMM-GoogleFit shows up in my google apps with permissions. Any ideas?

      Edit: Update, The issue has resolved without me doing anything different so I’m not quite sure what the issue was but the module is working great. Thank you for this!

      posted in Health
      S
      StacheEnthusiast
    • RE: PushBulletNotes - Phone Notifications on your mirror

      @malicious_banjo

      Welp…I was hoping to post back before you got to it but after a reboot it’s working flawlessly. I love it. It’s unobtrusive, informative, and simple to set up. Thank you very much!

      Side note, when performing the npm install, I got a message at the end that says npm WARN PushBulletNotes@1.1.1 No repository field. After a bit of googling, I found out that everything is smooth on the install but it is wanting you to add

      "repository": {
        "type": "git",
        "url": "git://github.com/maliciousbanjo/PushBulletNotes.git"
      }
      

      to your package.json.

      Thanks again!

      posted in Utilities
      S
      StacheEnthusiast
    • RE: PushBulletNotes - Phone Notifications on your mirror

      @malicious_banjo
      I am pumped for this module! Thanks for your contribution. After install and configuration, it is showing as no notifications after I sent a couple tests that the chrome extension picked up. I can’t tell if I am being impatient or it is not working right.

      Do I need the pro version of PushBullet for this? What is the update interval?

      There is a link to the PushBullet REST API and this is installed via the npm install right?

      I was a little confused on the ‘read me’ under the API token it says that I would need PushBullet app installed on my device but you’re just referring to having a PushBullet account/app on phone, correct?

      posted in Utilities
      S
      StacheEnthusiast
    • RE: MMM-PIR-Sensor Guide with Edits and Updates

      @Mykle1

      Thanks!

      posted in Development
      S
      StacheEnthusiast
    • MMM-PIR-Sensor Guide with Edits and Updates

      I recently got the MMM-PIR-Sensor up and going and it’s working flawlessly. I wanted to give a little information as I had to parse this from different sources and some of the info is a bit dated.

      I am relatively new to pi in general so definitely point it out if something isn’t right.

      Below is a step by step for MMM-PIR-Sensor by paviro.

      Navigate to your modules folder at cd ~/MagicMirror/modules
      Execute git clone https://github.com/paviro/MMM-PIR-Sensor.git
      Navigate to cd ~/MagicMirror/modules/MMM-PIR-Sensor

      This is one area I got held up
      The guide states to perform an npm install where a dated version(2.25) of wiring-pi would be installed.
      When issuing the command gpio -v, I would get an error message “Unable to determine hardware version. I see: Hardware : BCM2835 - expecting BCM2708 or BCM2709. Please report this to project@drogon.net”.

      Instead use npm install wiring-pi inside your MMM-PIR-Sensor folder. This will install the updated version(2.44) which you can verify with gpio -v.

      Then issue command sudo usermod -a -G gpio pi
      Then sudo chmod u+s /opt/vc/bin/tvservice && sudo chmod u+s /bin/chvt

      The guide says to reboot here but after that, it still wasn’t working for me. Then I stumbled on some excellent advice from the forums here from @JamesMM with @strawberry 3.141 contributing.

      Their focus was on the node_helper.js within the module. These are their edits.

      First, rename the current file. mv node_helper.js node_helper_backup.js

      Now, create a new file called node_helper.js using sudo nano node_helper.js

      Copy and paste this code

      'use strict';
      
      /* Magic Mirror
       * Module: MMM-PIR-Sensor
       *
       * By Paul-Vincent Roll http://paulvincentroll.com
       * MIT Licensed.
       */
      
      const NodeHelper = require('node_helper');
      const Gpio = require('onoff').Gpio;
      const exec = require('child_process').exec;
      
      module.exports = NodeHelper.create({
        start: function()
      {
          this.started = false;
      },
      
        activateMonitor: function()
      {
          if (this.config.relayPIN != false)
          {
              this.relay.writeSync(this.config.relayOnState);
          }
          else if (this.config.relayPIN == false)
          {
              // Check if hdmi output is already on
              exec("/opt/vc/bin/tvservice -s").stdout.on('data', function(data) {
                  if (data.indexOf("0x120002") !== -1)
                      exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
              });
          }
      },
      
        deactivateMonitor: function()
      {
          if (this.config.relayPIN != false)
          {
              this.relay.writeSync(this.config.relayOffState);
          }
          else if (this.config.relayPIN == false)
          {
              exec("/opt/vc/bin/tvservice -o", null);
          }
      },
      
        // Subclass socketNotificationReceived received.
        socketNotificationReceived: function(notification, payload)
      {
          if (notification === 'CONFIG' && this.started == false)
          {
              const self = this;
              this.config = payload;
              self.timer = null;
              self.onState = 0;
      
              // Setup value which represent on and off
              const valueOn = this.config.invertSensorValue ? 0 : 1;
              const valueOff = this.config.invertSensorValue ? 1 : 0;
      
              //Log.info('PIR: ' + this.name);
      
              //Setup pins
              this.pir = new Gpio(this.config.sensorPIN, 'in', 'both');
      
              if (this.config.relayPIN)
              {
                  this.relay = new Gpio(this.config.relayPIN, 'out');
                  this.relay.writeSync(this.config.relayOnState);
                  exec("/opt/vc/bin/tvservice --preferred && sudo chvt 6 && sudo chvt 7", null);
              }
      
              //Detected movement
              this.pir.watch(function(err, value) {
                  if (value == 1)
                  {
                      clearTimeout(self.timer);
                      if (self.onState != 1)
                      {
                          self.sendSocketNotification("USER_PRESENCE", true);
                          if (self.config.powerSaving)
                          {
                              self.activateMonitor();
                              self.onState = 1;
                          }
                      }
                  }
                  else if (value == 0)
                  {
                      if (self.onState != 0)
                      {
                          self.timer = setTimeout(function(){
                              self.sendSocketNotification("USER_PRESENCE", false);
                              if (self.config.powerSaving)
                              {
                                  self.deactivateMonitor();
                                  self.onState = 0;
                              }
                          }, self.config.offDelay);
                      }
                  }
              });
      
              this.started = true;
      
          }
          else if (notification === 'SCREEN_WAKEUP')
          {
              this.activateMonitor();
          }
      }
      
      });
      

      This creates a new config called offDelay and it is in configurable in milliseconds.
      Reboot your pi.

      Then add the modules configuration to MM’s config.js. I used this but obviously adjust it to your own needs.

      	{
      		module: 'MMM-PIR-Sensor',
      		config: {
      			sensorPIN: 22,
      			powerSaving: true,
      			offDelay: 30000,
      		}
      	}
      

      The offDelay of 30000 is 30 seconds.

      posted in Development
      S
      StacheEnthusiast
    • C# Module Ideas for project

      I am making a mirror to showcase for a class project. Part of the requirements are that I actually develop something, specifically in C#. I know I can use C# through the Mono framework but past that, I’m not sure what to do. I’ve thought about creating a module for BlackBoard. Any ideas on what I could work on?

      posted in Development
      S
      StacheEnthusiast