syntex-automation
Advanced tools
Comparing version 1.2.0-b23 to 1.2.0-b24
{ | ||
"name": "syntex-automation", | ||
"version": "1.2.0-b23", | ||
"version": "1.2.0-b24", | ||
"description": "An automation system for your smart home", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -146,2 +146,13 @@ const axios = require('axios'); | ||
}); | ||
this.EventManager.setInputStream('updateAutomation', { source : this, external : true }, () => { | ||
this.loadAutomation().then((success) => { | ||
if(success) | ||
{ | ||
this.logger.log('success', 'automation', 'Automation', '%automation_load_success%!'); | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -606,16 +617,39 @@ } | ||
{ | ||
if(block.time != null && block.time.begin != null && block.time.begin.includes(':') && block.time.end != null && block.time.end.includes(':')) | ||
if(block.time != null && block.time.includes(':') && block.operation != null) | ||
{ | ||
var now = new Date(), begin = new Date(), end = new Date(); | ||
begin.setHours(block.time.begin.split(':')[0]); | ||
begin.setMinutes(block.time.begin.split(':')[1]); | ||
begin.setMinutes(0); | ||
begin.setSeconds(0); | ||
begin.setMilliseconds(0); | ||
end.setHours(block.time.end.split(':')[0]); | ||
end.setMinutes(block.time.end.split(':')[1]); | ||
end.setMinutes(0); | ||
end.setSeconds(0); | ||
end.setMilliseconds(0); | ||
if(block.operation == '>') | ||
{ | ||
begin.setHours(block.time.split(':')[0]); | ||
begin.setMinutes(block.time.split(':')[1]); | ||
end.setHours(24); | ||
} | ||
if(block.operation == '<') | ||
{ | ||
begin.setHours(0); | ||
end.setHours(block.time.split(':')[0]); | ||
end.setMinutes(block.time.split(':')[1]); | ||
} | ||
if(block.operation == '=') | ||
{ | ||
begin.setHours(block.time.split(':')[0]); | ||
begin.setMinutes(block.time.split(':')[1]); | ||
end.setHours(block.time.split(':')[0]); | ||
end.setMinutes(parseInt(block.time.split(':')[1]) + 1); | ||
} | ||
if(now.getTime() > begin.getTime() | ||
@@ -628,3 +662,3 @@ && now.getTime() < end.getTime()) | ||
if(block.operation != null && block.id != null && block.letters != null && block.state != null) | ||
if(block.id != null && block.letters != null && block.state != null && block.operation != null) | ||
{ | ||
@@ -631,0 +665,0 @@ if(block.operation == '>') |
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
27168
734