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

    Chiggo

    @Chiggo

    1
    Reputation
    604
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Chiggo Unfollow Follow

    Best posts made by Chiggo

    • RE: Roomtemperature with DS18B20

      @Phate

      No, it’s not available on GitHub. But with the hints from @MichMich it was pretty easy to realize.

      To load the drivers for the DS18B20 I followed these instructions https://www.kompf.de/weather/pionewiremini.html

      To get the DS18B20 working with node.js I installed this https://www.npmjs.com/package/ds18x20

      And finaly I edited the scripts of the systemtemperature-module and it works.

      Step-by-Step

      • Add this line to your /boot/config.txt
      dtoverlay=w1-gpio,gpiopin=4,pullup=on
      
      • Add to your /etc/modules following and reboot the Pi
      w1-gpio pullup=1 
      w1-therm
      
      • Note the ID of your sensor (go to /sys/bus/w1/devices and list the files, the ID should look something like this 28-04163746c8ff
      • Got to /MagicMirror/modules and create a folder named MMM-Temperature
      • Create a file named MMM-Temperature.js and copy the code from my post for this script
      • Create a file named node_helper.js and copy the code from my post and change the ID of my sensor to yours (it’s in line 16)
      • Register this module in your /MagicMirror/config/config.js
      • Restart your MM and you are done :)

      Hope I could help. Let me know if it works.

      posted in Troubleshooting
      C
      Chiggo

    Latest posts made by Chiggo

    • RE: MMM-PIR-Sensor restart problem

      Not sure, but isn’t there a wiring mismatch in the picture of your post?

      Think you mixed up brown and orange.
      Orange (VCC), coming from PIR-Sensor, should go to PIN2 and brown (GND), coming from PIR, should go to PIN6.

      To your last post:
      I would prefer to add the modules from github, not copy.
      Are the libraries and drivers for wiring-pi already installed?

      posted in Troubleshooting
      C
      Chiggo
    • RE: Roomtemperature with DS18B20

      @Phate

      No, it’s not available on GitHub. But with the hints from @MichMich it was pretty easy to realize.

      To load the drivers for the DS18B20 I followed these instructions https://www.kompf.de/weather/pionewiremini.html

      To get the DS18B20 working with node.js I installed this https://www.npmjs.com/package/ds18x20

      And finaly I edited the scripts of the systemtemperature-module and it works.

      Step-by-Step

      • Add this line to your /boot/config.txt
      dtoverlay=w1-gpio,gpiopin=4,pullup=on
      
      • Add to your /etc/modules following and reboot the Pi
      w1-gpio pullup=1 
      w1-therm
      
      • Note the ID of your sensor (go to /sys/bus/w1/devices and list the files, the ID should look something like this 28-04163746c8ff
      • Got to /MagicMirror/modules and create a folder named MMM-Temperature
      • Create a file named MMM-Temperature.js and copy the code from my post for this script
      • Create a file named node_helper.js and copy the code from my post and change the ID of my sensor to yours (it’s in line 16)
      • Register this module in your /MagicMirror/config/config.js
      • Restart your MM and you are done :)

      Hope I could help. Let me know if it works.

      posted in Troubleshooting
      C
      Chiggo
    • RE: Roomtemperature with DS18B20

      It works!

      after testing some things PM2 didn’t work anymore, so i recovered from a backup, installed the drivers for the DS18B20 again, copied the scripts back, restarted and it works.

      Don’t know why and how, but it does :smile:

      Solved!

      posted in Troubleshooting
      C
      Chiggo
    • RE: Roomtemperature with DS18B20

      Spend some time to figure out what you mean, but i stuck again.
      Now at this point picture

      Here is the MMM-Temperature.js

      Module.register('MMM-Temperature', {
      
              defaults: {
                      prependString: 'Raumtemperatur: '
              },
      
      
              start: function() {
                      this.temperature = 'fetching...';
                      this.sendSocketNotification('CONNECT');
              },
      
      
              socketNotificationReceived: function(notification, temp) {
                  if (notification === 'TEMPERATURE') {
                      this.temperature = temp;
                      this.updateDom();
                  }
              },
      
      
              // Override dom generator.
              getDom: function() {
                      var wrapper = document.createElement("div");
                      wrapper.innerHTML = this.config.prependString + this.temperature;
                      return wrapper;
              },
      
      });
      

      And here is the node_helper.js

      var NodeHelper = require("node_helper");
      var sensor = require('ds18x20');
      
      
       module.exports = NodeHelper.create({
              start: function function_name () {
                      var self = this;
                      setInterval(function() {
                              self.sendTemperature();
                      }, 10000);
              },
      
      
              sendTemperature: function() {
                      var self = this;
                      var temp = sensor.get('28-04163746c8ff');
                      self.sendSocketNotification('TEMPERATURE', temp);
              },
       });
      

      It seems that the MMM-Temperature module is not trying to call the node_helper.js
      Not sure why it doesn’t. Or even if, i don’t know why the node_helper.js doesn’t work.

      Maybe this has something to do with the "sendSocketNotification(‘CONNECT’) ???
      It’s never mentioned in the node_helper.

      posted in Troubleshooting
      C
      Chiggo
    • RE: Roomtemperature with DS18B20

      Thank you for fast reply.

      I will give it a try tomorrow and check if i get it.
      My first steps in JS :sweat_smile:

      posted in Troubleshooting
      C
      Chiggo
    • Roomtemperature with DS18B20

      Hello everybody,

      I am new to this forum and I am trying to display the roomtemperature with a DS18B20 sensor at my MagicMirrorv2.

      I have installed ‘ds18x20’ to get the temperature using node.js, butit seems to be impossible for me, to display this at my MagicMirror.
      I can read the temp using this commands, and it shows the temp at the console.

      var sensor = require('ds18x20');
      var temp = sensor.get('28-00000574c791');
      console.log(temp);
      

      I tried to write a module from exsting code to display the temp at the mirror, but everything it shows is this picture

      Here is the code

      /* global Module */
      /* Magic Mirror
       * Module: MMM-Temperature
       */
      
      Module.register('MMM-Temperature', {
      // Define start sequence.
              start: function() {
                      Log.info("Starting module: " + this.name);
                      // Schedule update interval.
                      var self = this;
                      setInterval(function() {
                              self.updateDom();
                      }, 1000);
      },
      
      // Get temperature.
      tempRead: function() {
              var sensor = require ('ds18x20');
              var temp = sensor.get('28-04163746c8ff');
              return temp;
      },
      
      
      // Override dom generator.
              getDom: function() {
      var temperature = this.tempRead();
      
      var celsius = document.createTextNode(temperature);
      var wrapper = document.createElement("div");
      wrapper.appendChild(celsius);
      return wrapper;
      }
      });
      

      Can someone explain to me, how to get this thing working!?

      posted in Troubleshooting
      C
      Chiggo