Socket
Socket
Sign inDemoInstall

syntex-automation

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syntex-automation - npm Package Compare versions

Comparing version 1.0.2-b10 to 1.0.2-b11

117

automation.js

@@ -10,30 +10,33 @@ let TypeManager = require('./type-manager');

{
constructor(log, storagePath, DataManager, isServer, EventManager)
constructor(Logger, storagePath, DataManager, isServer, EventManager)
{
logger = log;
storage = store(storagePath);
console.log('STORAGE PATH', storagePath);
logger = Logger;
dataManager = DataManager;
eventManager = EventManager;
serverMode = isServer;
dataManager = DataManager;
eventManager = EventManager;
serverMode = isServer;
TypeManager = new TypeManager(logger);
storage.load('automation-lock', (err, obj) => {
if(storagePath != null)
{
storage = store(storagePath);
if(!obj || err)
{
logger.log('error', 'bridge', 'Bridge', 'Automation-Lock.json %read_error%! ' + err);
}
else
{
eventLock = obj.eventLock || [];
positiveFired = obj.positiveFired || [];
negativeFired = obj.negativeFired || [];
}
storage.load('automation-lock', (err, obj) => {
this.loadAutomation();
});
if(!obj || err)
{
logger.log('error', 'bridge', 'Bridge', 'Automation-Lock.json %read_error%! ' + err);
}
else
{
eventLock = obj.eventLock || [];
positiveFired = obj.positiveFired || [];
negativeFired = obj.negativeFired || [];
}
this.loadAutomation();
});
}
console.log('STORAGE PATH', storagePath);
}

@@ -71,38 +74,41 @@

{
if(!serverMode)
{
eventManager.sendToAutomationServer(id, letters, { value : value });
}
value = value.toString();
for(var i = 0; i < this.automation.length; i++)
if(ready)
{
if(eventLock.includes(this.automation[i].id))
if(!serverMode)
{
for(var j = 0; j < this.automation[i].trigger.length; j++)
eventManager.sendToAutomationServer(id, letters, { value : value });
}
value = value.toString();
for(var i = 0; i < this.automation.length; i++)
{
if(eventLock.includes(this.automation[i].id))
{
if(this.automation[i].trigger[j].id == id && this.automation[i].trigger[j].letters == letters)
for(var j = 0; j < this.automation[i].trigger.length; j++)
{
var index = eventLock.indexOf(this.automation[i].id);
if(this.automation[i].trigger[j].operation == '>' && parseFloat(value) < parseFloat(this.automation[i].trigger[j].value) && negativeFired.includes(this.automation[i].trigger[j].id))
if(this.automation[i].trigger[j].id == id && this.automation[i].trigger[j].letters == letters)
{
eventLock.splice(index, 1);
var index = eventLock.indexOf(this.automation[i].id);
logger.debug('Automation [' + this.automation[i].name + '] Unterschritten ' + this.automation[i].id);
}
if(this.automation[i].trigger[j].operation == '>' && parseFloat(value) < parseFloat(this.automation[i].trigger[j].value) && negativeFired.includes(this.automation[i].trigger[j].id))
{
eventLock.splice(index, 1);
if(this.automation[i].trigger[j].operation == '<' && parseFloat(value) > parseFloat(this.automation[i].trigger[j].value) && positiveFired.includes(this.automation[i].trigger[j].id))
{
eventLock.splice(index, 1);
logger.debug('Automation [' + this.automation[i].name + '] Unterschritten ' + this.automation[i].id);
}
logger.debug('Automation [' + this.automation[i].name + '] Überschritten ' + this.automation[i].id);
}
if(this.automation[i].trigger[j].operation == '<' && parseFloat(value) > parseFloat(this.automation[i].trigger[j].value) && positiveFired.includes(this.automation[i].trigger[j].id))
{
eventLock.splice(index, 1);
if(this.automation[i].trigger[j].operation == '=' && value != this.automation[i].trigger[j].value)
{
eventLock.splice(index, 1);
logger.debug('Automation [' + this.automation[i].name + '] Überschritten ' + this.automation[i].id);
}
logger.debug('Automation [' + this.automation[i].name + '] Ungleich ' + this.automation[i].id);
if(this.automation[i].trigger[j].operation == '=' && value != this.automation[i].trigger[j].value)
{
eventLock.splice(index, 1);
logger.debug('Automation [' + this.automation[i].name + '] Ungleich ' + this.automation[i].id);
}
}

@@ -112,17 +118,12 @@ }

}
}
for(var i = 0; i < this.automation.length; i++)
{
if(this.automation[i].active && !eventLock.includes(this.automation[i].id))
for(var i = 0; i < this.automation.length; i++)
{
checkTrigger(this.automation[i], id, letters, value.toString());
if(this.automation[i].active && !eventLock.includes(this.automation[i].id))
{
checkTrigger(this.automation[i], id, letters, value.toString());
}
}
}
}
isReady()
{
return ready;
}
};

@@ -129,0 +130,0 @@

{
"name": "syntex-automation",
"version": "1.0.2-b10",
"version": "1.0.2-b11",
"description": "An automation system for your smart home",

@@ -5,0 +5,0 @@ "main": "main.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc