Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add files via upload
  • Loading branch information
AgP42 authored Jul 11, 2018
commit 647180fe8cb79c713f75700d845ba09dd6bea21f
21 changes: 11 additions & 10 deletions MMM-Jeedom.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';

//Ajout AgP - 11/07/2018
var IntervalID = 0; //Pour pouvoir couper et relancer l'update régulier
//pour gerer le PIR et le module.hidden en meme temps
var UserPresence = true; // par défaut on est présent (pas de sensor PIR pour couper)
var ModuleHidden = false; // par défaut on affiche le module (pas de module carousel ou autre)
var ModuleHidden = false; // par défaut on affiche le module (si pas de module carousel ou autre)
//Fin ajout AgP

Module.register("MMM-Jeedom",{
Expand All @@ -16,6 +15,7 @@ Module.register("MMM-Jeedom",{
updateInterval: 5000, //5s
initialLoadDelay: 0,
animationSpeed: 1000,
IntervalID: 0, // ne sert à rien pourles utilisateurs, mais à déclarer pour chaque instance pour pouvoir couper la mise à jour pour chacune
result: {},
sensors: [
{
Expand All @@ -39,8 +39,8 @@ Module.register("MMM-Jeedom",{
this.title = "Loading...";
this.loaded = false;
var self = this;
//Ajout AgP : IntervalID ci-dessous. Le définir permet de le couper après.
IntervalID = setInterval(function() { self.updateJeedom(); }, this.config.updateInterval);
//Ajout AgP : IntervalID ci-dessous. Le définir permet de le couper après. Il faut this. car on en défini 1 par instance Jeedom.
this.IntervalID = setInterval(function() { self.updateJeedom(); }, this.config.updateInterval);
this.sensors = [];
for (var c in this.config.sensors) {
var sensor = this.config.sensors[c];
Expand Down Expand Up @@ -83,13 +83,13 @@ Module.register("MMM-Jeedom",{
// update tout de suite
self.updateJeedom();
//et on remet l'intervalle d'update en route, si aucun deja actif (pour éviter les instances multiples)
if (IntervalID === 0){
IntervalID = setInterval(function() { self.updateJeedom(); }, this.config.updateInterval);
if (this.IntervalID === 0){
this.IntervalID = setInterval(function() { self.updateJeedom(); }, this.config.updateInterval);
}
}else{ //sinon (UserPresence = false OU ModuleHidden = true)
//Log.log("Personne regarde : on stop l'update !");
clearInterval(IntervalID); // on arrete l'intervalle d'update en cours
IntervalID=0; //on reset la variable
clearInterval(this.IntervalID); // on arrete l'intervalle d'update en cours
this.IntervalID=0; //on reset la variable
}
},

Expand Down Expand Up @@ -152,7 +152,8 @@ Module.register("MMM-Jeedom",{
updateJeedom: function() {
this.sendSocketNotification('RELOAD',this.config);
//AgP
//console.log("Hello, update module Jeedom demandé!! IntervalID : " + IntervalID);
//console.log("Hello, update module Jeedom demandé!! IntervalID : " + this.IntervalID);
//this.sendNotification("SHOW_ALERT",{type:"notification",message:"Update Jeedom demandée"});
},

socketNotificationReceived: function(notification, payload) {
Expand All @@ -170,4 +171,4 @@ Module.register("MMM-Jeedom",{
}
}

});
});
5 changes: 0 additions & 5 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ var NodeHelper = require("node_helper");
const https = require('https');
const http = require('http');

//var temps = new Date();

module.exports = NodeHelper.create({
start: function() {

Expand All @@ -25,9 +23,6 @@ module.exports = NodeHelper.create({
postData = postData + refConfig.jeedomAPIKey+'", "id": ' + ids + ']}}';
//modif AGP
//console.log(postData);
//temps.getTime();
//console.log("Hello, je reload !!");
//fin modifs AgP
var options = {
hostname: refConfig.jeedomURL,
port: refConfig.jeedoJeedommPORT,
Expand Down