node-red-contrib-sun-position
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -7,15 +7,36 @@ # node-red-contrib-sun-position | ||
- change to the installation directory of Node-Red | ||
- enter the command `npm install node-red-contrib-sun-position@1.2.0` | ||
- enter the command `npm install node-red-contrib-sun-position@1.2.3` | ||
Install of a specific Version in a Homematic: | ||
Install of a specific Version in Redmatic (on a Homematic): | ||
- logon per ssh | ||
- enter the commands: | ||
- enter the commands in the order: | ||
- `source /usr/local/addons/redmatic/home/.profile` | ||
- `cd /usr/local/addons/redmatic/var` | ||
- `npm install --save --no-package-lock --global-style --save-prefix="~" --production node-red-contrib-sun-position@1.2.0` | ||
- `npm install --save --no-package-lock --global-style --save-prefix="~" --production node-red-contrib-sun-position@1.2.3` | ||
This can be also used to go back to an older Version. | ||
#### 1.2.4: maintenance + critical bugfix | ||
- time-span | ||
- fixed bug that second operand displayed wrong in config! | ||
- fixed critical output bug #240 | ||
- blind-control + clock-time | ||
- added additional information in the output | ||
- last data which contain data from the last evaluation (when the rules was last time evaluated) - #223 | ||
- for blind-control `msg.blindCtrl.lastEvaluated.sunLevel`, `msg.blindCtrl.lastEvaluated.ruleLevel`, `msg.blindCtrl.lastEvaluated.ruleTopic`, `msg.blindCtrl.lastEvaluated.level`, `msg.blindCtrl.lastEvaluated.ruleId` | ||
- for clock-time `msg.timeCtrl.lastEvaluated.payload`, `msg.timeCtrl.lastEvaluated.topic`, `msg.timeCtrl.lastEvaluated.ruleId` `msg.timeCtrl.lastEvaluated.ruleTopic` | ||
- `msg.blindCtrl.name` / `msg.timeCtrl.name` which is the name of the node (or the id if no name is given in the config) - #238 | ||
- this information will be send as `msg.payload.name` to the second output if two outputs are configured | ||
- `msg.blindCtrl.id` / `msg.timeCtrl.id` which is the id of the node | ||
- this information will be send as `msg.payload.id` to the second output if two outputs are configured | ||
- blind-control only | ||
- renamed `msg.resetOnSameValue` to `msg.resetOnSameAsLastValue` parameter to reset existing overwrite if `msg.payload` equals to position (`node.previousData.level`) (#223) | ||
#### 1.2.3: BugFix | ||
- within-time-switch | ||
- fix bug that time limitations does not work #236 upstream of #192) | ||
- fix bug that time limitations does not work #236 upstream of #192) | ||
@@ -22,0 +43,0 @@ #### 1.2.2: BugFix |
@@ -268,11 +268,9 @@ /******************************************** | ||
node.debug(`overwrite newPos=${newPos}`); | ||
const noSameValue = hlp.getMsgBoolValue(msg, 'ignoreSameValue'); | ||
const resetOnSameValue = hlp.getMsgBoolValue(msg, 'resetOnSameValue'); | ||
if (noSameValue && (node.previousData.level === newPos)) { | ||
node.debug(`overwrite exit true ignoreSameValue=${noSameValue}, newPos=${newPos}`); | ||
return ctrlLib.setOverwriteReason(node); | ||
} if (resetOnSameValue && (node.previousData.level === newPos)) { | ||
node.debug(`resetOnSameValue active, reset overwrite and exit newPos=${newPos}`); | ||
if (hlp.getMsgBoolValue(msg, 'resetOnSameAsLastValue') && (node.previousData.level === newPos)) { | ||
node.debug(`resetOnSameAsLastValue active, reset overwrite and exit newPos=${newPos}`); | ||
ctrlLib.posOverwriteReset(node); | ||
return ctrlLib.setOverwriteReason(node); | ||
} else if (hlp.getMsgBoolValue(msg, 'ignoreSameValue') && (node.previousData.level === newPos)) { | ||
node.debug(`overwrite exit true (ignoreSameValue), newPos=${newPos}`); | ||
return ctrlLib.setOverwriteReason(node); | ||
} | ||
@@ -333,2 +331,3 @@ node.level.current = newPos; | ||
node.level.topic = node.sunData.topic; | ||
node.previousData.last.sunLevel = node.level.current; | ||
node.reason.code = 13; | ||
@@ -357,2 +356,3 @@ node.reason.state = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.states.sunNotInWinMin'); | ||
node.level.currentInverse = getInversePos_(node, node.level.current); | ||
node.previousData.last.sunLevel = node.level.current; | ||
node.level.topic = node.oversteer.topic; | ||
@@ -372,2 +372,3 @@ node.reason.code = 10; | ||
node.level.currentInverse = getInversePos_(node, node.level.current); | ||
node.previousData.last.sunLevel = node.level.current; | ||
node.level.topic = node.sunData.topic; | ||
@@ -438,2 +439,3 @@ node.reason.code = 12; | ||
} | ||
node.previousData.last.sunLevel = node.level.current; | ||
// node.debug(`calcBlindSunPosition end pos=${node.level.current} reason=${node.reason.code} description=${node.reason.description}`); | ||
@@ -871,3 +873,4 @@ return sunPosition; | ||
reasonCode: -1, | ||
usedRule: NaN | ||
usedRule: NaN, | ||
last : {} | ||
}; | ||
@@ -1023,3 +1026,6 @@ | ||
blind: node.nodeData, | ||
autoTrigger : node.autoTrigger | ||
autoTrigger : node.autoTrigger, | ||
lastEvaluated: node.previousData.last, | ||
name: node.name || node.id, | ||
id: node.id | ||
}; | ||
@@ -1030,6 +1036,9 @@ let ruleId = -1; | ||
let overwrite = checkPosOverwrite(node, msg, dNow); | ||
node.debug(`overwrite=${overwrite}, node.rules.maxImportance=${node.rules.maxImportance}, node.nodeData.overwrite.importance=${node.nodeData.overwrite.importance}`); | ||
if (!overwrite || node.rules.canResetOverwrite || (node.rules.maxImportance > 0 && node.rules.maxImportance > node.nodeData.overwrite.importance)) { | ||
// calc times: | ||
blindCtrl.rule = checkRules(node, msg, dNow, tempData); | ||
node.previousData.last.ruleId = blindCtrl.rule.id; | ||
node.previousData.last.ruleLevel = blindCtrl.rule.level; | ||
node.previousData.last.ruleTopic = blindCtrl.rule.topic; | ||
node.debug(`overwrite=${overwrite}, node.rules.maxImportance=${node.rules.maxImportance}, node.nodeData.overwrite.importance=${node.nodeData.overwrite.importance}, blindCtrl.rule.importance=${blindCtrl.rule.importance}`); | ||
@@ -1080,2 +1089,4 @@ if (overwrite && blindCtrl.rule.resetOverwrite && blindCtrl.rule.id !== node.previousData.usedRule) { | ||
} | ||
node.previousData.last.level = node.level.current; | ||
node.previousData.last.topic = node.level.topic; | ||
} | ||
@@ -1117,3 +1128,4 @@ } | ||
const topicAttrs = { | ||
name: node.name, | ||
name: blindCtrl.name, | ||
id: blindCtrl.id, | ||
level: blindCtrl.level, | ||
@@ -1143,3 +1155,3 @@ levelInverse: blindCtrl.levelInverse, | ||
} else { | ||
send(msg, null); | ||
send([msg, null]); | ||
} | ||
@@ -1146,0 +1158,0 @@ } else if (node.outputs > 1) { |
@@ -311,3 +311,3 @@ /******************************************** | ||
} | ||
livingRuleData.state= RED._('node-red-contrib-sun-position/position-config:ruleCtrl.states.'+name, data); | ||
livingRuleData.state = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.states.'+name, data); | ||
livingRuleData.description = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.reasons.'+name, data); | ||
@@ -358,2 +358,4 @@ // node.debug(`checkRules end livingRuleData=${util.inspect(livingRuleData, { colors: true, compact: 10, breakLength: Infinity })}`); | ||
const node = this; | ||
// node.myNamename = config.name; | ||
this.debug(`starting ${config.name}, name = ${node.name}`); | ||
@@ -402,3 +404,4 @@ if (config.autoTrigger) { | ||
reasonCode: -1, | ||
usedRule: NaN | ||
usedRule: NaN, | ||
last : {} | ||
}; | ||
@@ -461,2 +464,7 @@ | ||
switch (msg.topic) { | ||
/* Default Settings */ | ||
case 'setSettingsTopic': | ||
node.nodeData.topic = msg.payload || node.nodeData.topic; | ||
break; | ||
/* advanced Settings */ | ||
case 'setAutoTriggerTime': | ||
@@ -468,14 +476,5 @@ node.autoTrigger.defaultTime = parseFloat(msg.payload) || node.autoTrigger.defaultTime; | ||
break; | ||
case 'setSettingsTopic': | ||
node.nodeData.topic = msg.payload || node.nodeData.topic; | ||
break; | ||
default: | ||
break; | ||
} | ||
if (node.nodeData.levelTop < node.nodeData.levelBottom) { | ||
const tmp = node.nodeData.levelBottom; | ||
node.nodeData.levelBottom = node.nodeData.levelTop; | ||
node.nodeData.levelTop = tmp; | ||
node.levelReverse = true; | ||
} | ||
} | ||
@@ -505,3 +504,6 @@ | ||
const timeCtrl = { | ||
autoTrigger : node.autoTrigger | ||
autoTrigger : node.autoTrigger, | ||
lastEvaluated: node.previousData.last, | ||
name: node.name || node.id, | ||
id: node.id | ||
}; | ||
@@ -515,2 +517,5 @@ let ruleId = -2; | ||
timeCtrl.rule = checkRules(node, msg, dNow, tempData); | ||
node.previousData.last.ruleId = timeCtrl.rule.id; | ||
node.previousData.last.ruleTopic = timeCtrl.rule.topic; | ||
node.debug(`overwrite=${overwrite}, node.rules.maxImportance=${node.rules.maxImportance}, nodeData.overwrite.importance=${node.nodeData.overwrite.importance}`); | ||
@@ -529,2 +534,4 @@ if (overwrite && timeCtrl.rule.resetOverwrite && timeCtrl.rule.id !== node.previousData.usedRule) { | ||
node.reason.description = timeCtrl.rule.description; | ||
node.previousData.last.payload = node.payload.current; | ||
node.previousData.last.topic = node.payload.topic; | ||
} | ||
@@ -546,3 +553,4 @@ } | ||
const topicAttrs = { | ||
name: node.name, | ||
name: timeCtrl.name, | ||
id: timeCtrl.id, | ||
code: node.reason.code, | ||
@@ -572,3 +580,3 @@ state: node.reason.state, | ||
} else { | ||
send(msg, null); | ||
send([msg, null]); | ||
} | ||
@@ -575,0 +583,0 @@ } else if (node.outputs > 1) { |
@@ -319,15 +319,16 @@ /******************************************** | ||
const propNew = { | ||
outType : prop.pt, | ||
outValue : prop.p, | ||
type : prop.vt, | ||
value : prop.v, | ||
format : prop.f, | ||
offsetType : prop.oT, | ||
offset : prop.o, | ||
multiplier : prop.oM, | ||
next : (typeof prop.next === 'undefined' || prop.next === null || prop.next === true || prop.next === 'true') ? true : false, | ||
days : prop.days, | ||
months : prop.months, | ||
onlyEvenDays: prop.onlyEvenDays, | ||
onlyOddDays : prop.onlyOddDays | ||
outType : prop.pt, | ||
outValue : prop.p, | ||
type : prop.vt, | ||
value : prop.v, | ||
format : prop.f, | ||
offsetType : prop.oT, | ||
offset : prop.o, | ||
multiplier : prop.oM, | ||
outTSFormat : prop.fTs, | ||
next : (typeof prop.next === 'undefined' || prop.next === null || prop.next === true || prop.next === 'true') ? true : false, | ||
days : prop.days, | ||
months : prop.months, | ||
onlyEvenDays : prop.onlyEvenDays, | ||
onlyOddDays : prop.onlyOddDays | ||
}; | ||
@@ -392,9 +393,8 @@ | ||
// node.debug(`prepOutMsg-${i} node.results[${i}]=${util.inspect(prop, { colors: true, compact: 10, breakLength: Infinity })}`); | ||
let resultObj = null; | ||
if (node.result1Value.type === 'timespan') { | ||
resultObj = getFormattedTimeSpanOut(node, operand1.value, operand2.value, prop.result1TSFormat); | ||
} else if (node.result1Value.type === 'operand1') { | ||
if (prop.type === 'timespan') { | ||
resultObj = getFormattedTimeSpanOut(node, operand1.value, operand2.value, prop.outTSFormat); | ||
} else if (prop.type === 'operand1') { | ||
resultObj = node.positionConfig.formatOutDate(this, msg, operand1.value, prop); | ||
} else if (node.result1Value.type === 'operand2') { | ||
} else if (prop.type === 'operand2') { | ||
resultObj = node.positionConfig.formatOutDate(this, msg, operand2.value, prop); | ||
@@ -401,0 +401,0 @@ } else { |
{ | ||
"name": "node-red-contrib-sun-position", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "NodeRED nodes to get sun and moon position", | ||
@@ -108,3 +108,3 @@ "keywords": [ | ||
"eslint-plugin-html": "^6.1.1", | ||
"eslint-plugin-jsdoc": "^32.0.0", | ||
"eslint-plugin-jsdoc": "^32.0.2", | ||
"eslint-plugin-json": "^2.1.2", | ||
@@ -111,0 +111,0 @@ "eslint-plugin-node": "^11.1.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
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
1727932
14672
0