syntex-automation
Advanced tools
Comparing version 1.0.2-b4 to 1.0.2-b5
//let TypeManager = require('./type-manager'), AutomationSystem = require('syntex-automation'); | ||
const request = require('request'), store = require('json-fs-store'); | ||
var logger, storage; | ||
var logger, storage, eventManager; | ||
var eventLock = [], positiveFired = [], negativeFired = [], ready = false; | ||
@@ -8,8 +8,11 @@ | ||
{ | ||
constructor(log, storagePath, dataManager) | ||
constructor(log, storagePath, dataManager, EventManager) | ||
{ | ||
logger = log; | ||
storage = store(storagePath); | ||
storage = store(storagePath); | ||
console.log('STORAGE PATH', storagePath); | ||
this.dataManager = dataManager; | ||
this.dataManager = dataManager; | ||
eventManager = EventManager; | ||
@@ -38,2 +41,4 @@ //TypeManager = new TypeManager(logger); | ||
return new Promise((resolve) => { | ||
storage.list((err, obj) => console.log(obj)); | ||
@@ -49,3 +54,5 @@ storage.load('automation', (err, obj) => { | ||
this.automation = obj.automation; | ||
} | ||
} | ||
console.log(this.automation, obj); | ||
@@ -61,3 +68,5 @@ ready = true; | ||
{ | ||
value = value.value.toString(); | ||
value = value.toString(); | ||
console.log('RUN AUTOMATION', this.automation); | ||
@@ -116,3 +125,5 @@ for(var i = 0; i < this.automation.length; i++) | ||
{ | ||
var trigger = null; | ||
var trigger = null; | ||
console.log(value); | ||
@@ -224,3 +235,4 @@ for(var i = 0; i < automation.trigger.length; i++) | ||
} | ||
*/ | ||
*/ | ||
eventManager.setOutputStream('SynTexAutomation', { id : automation.result[i].id, letters : automation.result[i].letters }, { value : JSON.parse(automation.result[i].value) }); | ||
} | ||
@@ -227,0 +239,0 @@ |
18
main.js
@@ -13,3 +13,3 @@ const EventEmitter = require('events'), request = require('request'); | ||
this.LogikEngine = new LogikEngine(logger, storagePath, dataManager); | ||
this.LogikEngine = new LogikEngine(logger, storagePath, dataManager, this); | ||
} | ||
@@ -19,3 +19,8 @@ | ||
{ | ||
super.on(stream, (reciever, values) => callback(reciever, values)); | ||
super.on(stream, (reciever, values) => { | ||
console.log('<<<', stream, reciever, values); | ||
callback(reciever, values) | ||
}); | ||
} | ||
@@ -25,8 +30,7 @@ | ||
{ | ||
if(!super.emit(stream, reciever, values)) | ||
{ | ||
} | ||
super.emit(stream, reciever, values); | ||
sendToAutomationServer(reciever.id, reciever.letters, values); | ||
console.log('>>>', stream, reciever, values); | ||
this.sendToAutomationServer(reciever.id, reciever.letters, values); | ||
} | ||
@@ -33,0 +37,0 @@ |
{ | ||
"name": "syntex-automation", | ||
"version": "1.0.2-b4", | ||
"version": "1.0.2-b5", | ||
"description": "An automation system for your smart home", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10467
281