syntex-automation
Advanced tools
Comparing version 1.0.2-b1 to 1.0.2-b10
44
main.js
@@ -0,8 +1,16 @@ | ||
let LogikEngine = require('./automation'); | ||
const EventEmitter = require('events'), request = require('request'); | ||
class AutomationSystem extends EventEmitter | ||
module.exports = class AutomationSystem extends EventEmitter | ||
{ | ||
constructor() | ||
constructor(logger, storagePath, dataManager, isServer) | ||
{ | ||
super(); | ||
super.setMaxListeners(256); | ||
this.logger = logger; | ||
this.LogikEngine = new LogikEngine(logger, storagePath, dataManager, isServer, this); | ||
} | ||
@@ -12,3 +20,8 @@ | ||
{ | ||
super.on(stream, (reciever, values) => callback(reciever, values)); | ||
super.on(stream, (reciever, values) => { | ||
this.logger.debug('<<< ' + stream + ' ' + JSON.stringify(reciever) + ' ' + JSON.stringify(values)); | ||
callback(reciever, values) | ||
}); | ||
} | ||
@@ -18,17 +31,14 @@ | ||
{ | ||
if(!super.emit(stream, reciever, values)) | ||
{ | ||
} | ||
super.emit(stream, reciever, values); | ||
sendToAutomationServer(values); | ||
this.logger.debug('>>> ' + stream + ' ' + JSON.stringify(reciever) + ' ' + JSON.stringify(values)); | ||
} | ||
sendToAutomationServer(values) | ||
sendToAutomationServer(id, letters, values) | ||
{ | ||
var url = 'http://localhost:1777/update-automation', first = true; | ||
var url = 'http://localhost:1777/update-automation?id=' + id + '&letters=' + letters; | ||
for(const value in Object.keys(values)) | ||
for(const value of Object.keys(values)) | ||
{ | ||
url += (first ? '?' : '&') + value + '=' + values[value]; | ||
url += '&' + value + '=' + values[value]; | ||
} | ||
@@ -41,11 +51,5 @@ | ||
}; | ||
request(theRequest, () => {}); | ||
} | ||
} | ||
const automation = new AutomationSystem(); | ||
automation.setMaxListeners(256); | ||
module.exports = automation; | ||
} |
{ | ||
"name": "syntex-automation", | ||
"version": "1.0.2-b1", | ||
"version": "1.0.2-b10", | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
13109
5
348
1