Spend some time to figure out what you mean, but i stuck again.
Now at this point
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.