node-red-contrib-sun-position
Advanced tools
Comparing version 1.0.4 to 1.0.6
# node-red-contrib-sun-position | ||
#### 1.0.6: bug fix | ||
- general | ||
- fixed #102 - nodes calculate wrong sun times | ||
- this happend between midnight - TimezoneOffset to midnight | ||
- maybe fixes also #98 | ||
- fixed broken rule check for time-span #103 | ||
- blind-control + clock-time | ||
- first implementation of #92 (needs more test) | ||
#### 1.0.5: bug fix | ||
- blind-control + clock-time | ||
- add start delay setting where a time can be defined where no output | ||
#### 1.0.4: bug fix | ||
@@ -9,5 +27,5 @@ | ||
- sun-position | ||
- added lastUpdateStr to payload to get the original calculation base time | ||
- added `lastUpdateStr` to payload to get the original calculation base time | ||
- moon-position | ||
- added lastUpdateStr to payload to get the original calculation base time | ||
- added `lastUpdateStr` to payload to get the original calculation base time | ||
@@ -14,0 +32,0 @@ #### 1.0.3: bug fix |
@@ -449,2 +449,19 @@ /******************************************** | ||
} | ||
if (rule.timeDateStart || rule.timeDateEnd) { | ||
rule.timeDateStart.setFullYear(now.getFullYear()); | ||
const startnum = rule.timeDateStart.getTime(); | ||
rule.timeDateEnd.setFullYear(now.getFullYear()); | ||
const endnum = rule.timeDateEnd.getTime(); | ||
if (endnum > startnum) { | ||
// in the current year | ||
if (nowNr < startnum || nowNr >= endnum) { | ||
return null; | ||
} | ||
} else { | ||
// switch between year from end to start | ||
if (nowNr < startnum && nowNr >= endnum) { | ||
return null; | ||
} | ||
} | ||
} | ||
const num = getRuleTimeData(node, msg, rule, now); | ||
@@ -594,2 +611,5 @@ // node.debug(`pos=${rule.pos} type=${rule.timeOpText} - ${rule.timeValue} - rule.timeData = ${ util.inspect(rule.timeData, { colors: true, compact: 40, breakLength: Infinity }) }`); | ||
this.outputs = Number(config.outputs || 1); | ||
this.startDelayTime = parseFloat(config.startDelayTime); | ||
if (isNaN(this.startDelayTime) || this.startDelayTime < 10) { delete this.startDelayTime; } | ||
if (config.autoTrigger) { | ||
@@ -674,3 +694,3 @@ this.autoTrigger = { | ||
try { | ||
node.debug(`--- clock-timer - input msg.topic=${msg.topic} msg.payload=${msg.payload}`); | ||
node.debug(`--------- clock-timer - input msg.topic=${msg.topic} msg.payload=${msg.payload}`); | ||
// node.debug('input ' + util.inspect(msg, { colors: true, compact: 10, breakLength: Infinity })); // Object.getOwnPropertyNames(msg) | ||
@@ -735,3 +755,4 @@ if (!this.positionConfig) { | ||
((node.reason.code !== previousData.reasonCode) || | ||
(ruleId !== previousData.usedRule))) { | ||
(ruleId !== previousData.usedRule)) && | ||
node.startDelayTime) { | ||
msg.payload = node.payload.current; | ||
@@ -888,2 +909,17 @@ msg.topic = topic; | ||
rule.timeDateStart = rule.timeDateStart || ''; | ||
rule.timeDateEnd = rule.timeDateEnd || ''; | ||
if (rule.timeDateStart || rule.timeDateEnd) { | ||
if (rule.timeDateStart) { | ||
rule.timeDateStart = new Date(rule.timeDateStart); | ||
} else { | ||
rule.timeDateStart = new Date(2000,0,1); | ||
} | ||
if (rule.timeDateEnd) { | ||
rule.timeDateEnd = new Date(rule.timeDateEnd); | ||
} else { | ||
rule.timeDateStart = new Date(2000,11,31); | ||
} | ||
} | ||
if (rule.conditional) { | ||
@@ -946,4 +982,6 @@ rule.conditonData = [{ | ||
} */ | ||
if (node.autoTrigger) { | ||
if (node.autoTrigger || (node.startDelayTime)) { | ||
setTimeout(() => { | ||
delete node.startDelayTime; | ||
node.emit('input', { | ||
@@ -954,19 +992,17 @@ topic: 'autoTrigger/triggerOnly/start', | ||
}); | ||
}, 30000 + Math.floor(Math.random() * 30000)); // 30s - 1min | ||
}, node.startDelayTime || (30000 + Math.floor(Math.random() * 30000))); // 30s - 1min | ||
} | ||
} | ||
setTimeout(() => { | ||
try { | ||
initialize(); | ||
} catch (err) { | ||
node.error(err.message); | ||
node.log(util.inspect(err, Object.getOwnPropertyNames(err))); | ||
node.status({ | ||
fill: 'red', | ||
shape: 'ring', | ||
text: RED._('node-red-contrib-sun-position/position-config:errors.error-title') | ||
}); | ||
} | ||
}, 200 + Math.floor(Math.random() * 600)); | ||
try { | ||
initialize(); | ||
} catch (err) { | ||
node.error(err.message); | ||
node.log(util.inspect(err, Object.getOwnPropertyNames(err))); | ||
node.status({ | ||
fill: 'red', | ||
shape: 'ring', | ||
text: RED._('node-red-contrib-sun-position/position-config:errors.error-title') | ||
}); | ||
} | ||
} | ||
@@ -973,0 +1009,0 @@ |
@@ -55,2 +55,3 @@ /* | ||
if (!isValidDate(date)) { | ||
console.log(`toDays: given date parameter is invalid!! date=${date}`); // eslint-disable-line no-console | ||
date = new Date(); | ||
@@ -60,3 +61,3 @@ } | ||
if (inUTC === false) { | ||
ms = ms - date.getTimezoneOffset() * 60 * 1000; | ||
ms = ms + (date.getTimezoneOffset() * 60 * 1000); | ||
} | ||
@@ -374,2 +375,3 @@ return ((ms / dayMs) + J1970) - J2000; | ||
SunCalc.getSunTimes = function (date, lat, lng, inUTC, noDeprecated) { | ||
// console.log(`getSunTimes date=${date.toISOString()} lat=${lat}, lng=${lng}, inUTC=${inUTC}, noDeprecated=${noDeprecated}`); | ||
if (isNaN(lat)) { | ||
@@ -653,2 +655,3 @@ throw new Error('latitude missing'); | ||
if (!isValidDate(date)) { | ||
console.log(`getMoonTimes: given date parameter is invalid!! date=${date}`); // eslint-disable-line no-console | ||
date = new Date(); | ||
@@ -655,0 +658,0 @@ } |
@@ -70,2 +70,3 @@ { | ||
"autoTrigger2": "dynamisch aber max aller", | ||
"startDelay": "Ausgabe bei Start verzögern", | ||
"validForDays": "gültige Tage", | ||
@@ -109,4 +110,4 @@ "validForMonths": "gültige Monate", | ||
"level": "Behanghöhe", | ||
"autoTrigger": "automatisches triggern der Neuberechnung der Rollladenposition nach einer dynamischen Zeitspanne" | ||
"autoTrigger": "automatisches triggern der Neuberechnung der Rollladenposition nach einer dynamischen Zeitspanne", | ||
"startDelay": "verzögert die Ausgabe auf dem ersten Ausgang um die angegebene Zeit. Auf 0 setzen zum abschalten." | ||
}, | ||
@@ -113,0 +114,0 @@ "text": { |
@@ -43,3 +43,4 @@ { | ||
"autoTrigger":"automatisch triggern", | ||
"autoTrigger2":"dynamisch aber max aller" | ||
"autoTrigger2":"dynamisch aber max aller", | ||
"startDelay": "Ausgabe bei Start verzögern" | ||
}, | ||
@@ -63,3 +64,4 @@ "placeholder": { | ||
"ruleTimeMonths": "wähle Monate an denen diese Regel gültig sein soll", | ||
"autoTrigger":"automatisches triggern der Neuberechnung der Rollladenposition nach einer dynamischen Zeitspanne" | ||
"autoTrigger":"automatisches triggern der Neuberechnung der Rollladenposition nach einer dynamischen Zeitspanne", | ||
"startDelay": "verzögert die Ausgabe auf dem ersten Ausgang um die angegebene Zeit. Auf 0 setzen zum abschalten." | ||
}, | ||
@@ -66,0 +68,0 @@ "text": { |
@@ -34,2 +34,4 @@ { | ||
"ruleBlindLevel": "blind position", | ||
"ruleTimeLimitStart": "only from", | ||
"ruleTimeLimitEnd": "to", | ||
"ruleLevelAbs": "↕ absolute", | ||
@@ -73,4 +75,6 @@ "ruleLevelMin": "⭳❗ minimum (oversteer)", | ||
"autoTrigger2": "dynamic, but max every", | ||
"startDelay": "delay output on start", | ||
"validForDays": "valid days", | ||
"validForMonths": "valid months", | ||
"validForDates":"valid period (year is ignored)", | ||
"specialDays": "special days", | ||
@@ -114,3 +118,7 @@ "onlyEven": "only even", | ||
"ruleTimeMonths": "select months wherefore it should be valid", | ||
"autoTrigger": "automatic triggers new calculation of the blind position in a dynamic changing time interval" | ||
"autoTrigger": "automatic triggers new calculation of the blind position in a dynamic changing time interval", | ||
"startDelay": "0", | ||
"startDelay2": "delay any output to the first (or only) output on start (Node-Red start, Deplay, ...). Set to 0 to deactivate.", | ||
"start":"tt.mm", | ||
"end":"tt.mm" | ||
}, | ||
@@ -117,0 +125,0 @@ "text": { |
@@ -29,2 +29,4 @@ { | ||
"ruleTopic": "Topic: ", | ||
"ruleTimeLimitStart": "only from", | ||
"ruleTimeLimitEnd": "to", | ||
"time": "time", | ||
@@ -45,4 +47,6 @@ "name": "name", | ||
"autoTrigger2": "dynamic, but max every", | ||
"startDelay": "delay output on start", | ||
"validForDays": "valid days", | ||
"validForMonths": "valid months", | ||
"validForDates":"valid period (year is ignored)", | ||
"specialDays": "special days", | ||
@@ -71,3 +75,7 @@ "onlyEven": "even", | ||
"ruleTimeMonths": "select months wherefore it should be valid", | ||
"autoTrigger": "automatic triggers new calculation of the rule in a dynamic changing time interval" | ||
"autoTrigger": "automatic triggers new calculation of the rule in a dynamic changing time interval", | ||
"startDelay": "0", | ||
"startDelay2": "delay any output to the first (or only) output on start (Node-Red start, Deplay, ...). Set to 0 to deactivate.", | ||
"start":"tt.mm", | ||
"end":"tt.mm" | ||
}, | ||
@@ -74,0 +82,0 @@ "text": { |
@@ -388,3 +388,3 @@ /******************************************** | ||
let result = false; | ||
switch (rule.operator) { | ||
switch (parseInt(rule.operator)) { | ||
case 1: // equal | ||
@@ -391,0 +391,0 @@ result = (timeSpan === ruleoperand); |
{ | ||
"name": "node-red-contrib-sun-position", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "NodeRED nodes to get sun and moon position", | ||
@@ -97,3 +97,6 @@ "keywords": [ | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-html": "^6.0.0" | ||
"eslint-plugin-html": "^6.0.0", | ||
"eslint-plugin-jsdoc": "^21.0.0", | ||
"eslint-plugin-json": "^2.1.0", | ||
"eslint-plugin-node": "^11.0.0" | ||
}, | ||
@@ -100,0 +103,0 @@ "disabledSettings": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
1473604
10709
6