From 92c90cf711620e6dc6f4fd56ad914fe1d5301dce Mon Sep 17 00:00:00 2001
From: Hypnos <12692680+Hypnos3@users.noreply.github.com>
Date: Sun, 28 Nov 2021 00:02:14 +0100
Subject: [PATCH 1/4] within-time-switch fix error with output value #363
---
nodes/locales/de/position-config.json | 5 +++-
nodes/locales/en-US/position-config.json | 1 +
nodes/locales/en-US/within-time-switch.json | 3 --
nodes/static/htmlglobal.js | 7 ++++-
nodes/within-time-switch.html | 31 ++++++++++++++-------
nodes/within-time-switch.js | 12 ++++----
package.json | 4 +--
7 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/nodes/locales/de/position-config.json b/nodes/locales/de/position-config.json
index 13a18ff..644d1ec 100644
--- a/nodes/locales/de/position-config.json
+++ b/nodes/locales/de/position-config.json
@@ -3,6 +3,8 @@
"label": {
"positionConfig": "Konfiguration",
"binary": "binär",
+ "infoText":"Die Konfiguration muss erstellt und deployed werden damit die Einstellungen angezeigt werden können.",
+ "loadingInfo":"lade Daten...",
"json": "json",
"jsonata": "jsonata Ausdr.",
"timestamp": "Zeitpunkt",
@@ -35,6 +37,7 @@
"types": {
"unlimited": "keine Limitierung",
"undefined": "nicht verwendet",
+ "msgInput": "eingangs Nachricht",
"datespecific": "Zeitpunkt (erweitert)",
"nodeId":"Node Name",
"nodeName":"Node ID",
@@ -89,7 +92,7 @@
"slat":"Lamellenposition",
"topic":"topic",
"ctrlObj":"Status object",
- "strPlaceholder": "string mit Platzhatern"
+ "strPlaceholder": "string mit Platzhaltern"
},
"typeOptions": {
"moonRise": "Mondaufgang",
diff --git a/nodes/locales/en-US/position-config.json b/nodes/locales/en-US/position-config.json
index 928c920..6ab96f7 100644
--- a/nodes/locales/en-US/position-config.json
+++ b/nodes/locales/en-US/position-config.json
@@ -37,6 +37,7 @@
"types": {
"unlimited":"no limitation",
"undefined":"not used",
+ "msgInput": "input message",
"datespecific":"timestamp enhanced",
"nodeId":"node name",
"nodeName":"node ID",
diff --git a/nodes/locales/en-US/within-time-switch.json b/nodes/locales/en-US/within-time-switch.json
index 9b9105a..38d70b2 100644
--- a/nodes/locales/en-US/within-time-switch.json
+++ b/nodes/locales/en-US/within-time-switch.json
@@ -36,9 +36,6 @@
"withinTimeValue": "in time payload",
"outOfTimeValue": "out of time payload"
},
- "typeLabel":{
- "input": "msg.payload of the input message"
- },
"placeholder": {
"propertyStart": "Property for alternate start time",
"propertyStartThreshold": "threshold",
diff --git a/nodes/static/htmlglobal.js b/nodes/static/htmlglobal.js
index b1a8fab..f4fe3cb 100644
--- a/nodes/static/htmlglobal.js
+++ b/nodes/static/htmlglobal.js
@@ -183,7 +183,12 @@ function getTypes(node) { // eslint-disable-line no-unused-vars
},
DateSpecific: {
value: 'dateSpecific',
- label: node._('node-red-contrib-sun-position/position-config:common.types.datespecific','timestamp enhanced'),
+ label: node._('node-red-contrib-sun-position/position-config:common.types.datespecific'),
+ hasValue: false
+ },
+ MsgInput: {
+ value: 'msgInput',
+ label: node._('node-red-contrib-sun-position/position-config:common.types.msgInput'),
hasValue: false
},
MsgPayload: {
diff --git a/nodes/within-time-switch.html b/nodes/within-time-switch.html
index cc7fafc..e239e30 100644
--- a/nodes/within-time-switch.html
+++ b/nodes/within-time-switch.html
@@ -265,19 +265,21 @@
},
withinTimeValue: {
value: 'true',
- required: true,
+ required: false,
validate: RED.validators.typedInput('withinTimeValueType')
},
withinTimeValueType: {
- value: 'input'
+ value: 'msgInput',
+ required: true
},
outOfTimeValue: {
value: 'false',
- required: true,
+ required: false,
validate: RED.validators.typedInput('outOfTimeValueType')
},
outOfTimeValueType: {
- value: 'input'
+ value: 'msgInput',
+ required: true
},
tsCompare: {
value: '0'
@@ -839,14 +841,17 @@
});
// #endregion timeAltEnd
// #region Output Values
+ if (node.withinTimeValueType === 'input') {
+ node.withinTimeValueType = types.MsgInput.value;
+ }
setupTInput(node, {
typeProp: 'withinTimeValueType',
valueProp: 'withinTimeValue',
width: 'calc(100% - 110px)',
- defaultType: 'input',
- defaultValue: 'true' ,
+ defaultType: node.withinTimeValueType || types.MsgInput.value,
+ defaultValue: node.withinTimeValue,
types: [
- { value: 'input', label: node._('within-time-switch.typeLabel.input'), hasValue: false },
+ types.MsgInput,
'str',
'num',
'bool',
@@ -883,14 +888,17 @@
types.nodeName
]
});
+ if (node.outOfTimeValueType === 'input') {
+ node.outOfTimeValueType = types.MsgInput.value;
+ }
setupTInput(node, {
typeProp: 'outOfTimeValueType',
valueProp: 'outOfTimeValue',
width: 'calc(100% - 110px)',
- defaultType: 'input',
- defaultValue: 'true' ,
+ defaultType: node.outOfTimeValueType || types.MsgInput.value,
+ defaultValue: node.outOfTimeValue,
types: [
- { value: 'input', label: node._('within-time-switch.typeLabel.input'), hasValue: false },
+ types.MsgInput,
'str',
'num',
'bool',
@@ -989,6 +997,9 @@
this.timeDays = getCheckboxesStr($('#within-time-switch-timeDays input[type=checkbox]:checked'), 7);
this.timeMonths = getCheckboxesStr($('#within-time-switch-timeMonths input[type=checkbox]:checked'), 12);
+
+ this.withinTimeValueType = $('#node-input-withinTimeValue').typedInput('type');
+ this.outOfTimeValueType = $('#node-input-outOfTimeValue').typedInput('type');
}
});
})();
diff --git a/nodes/within-time-switch.js b/nodes/within-time-switch.js
index 047224a..1707dec 100644
--- a/nodes/within-time-switch.js
+++ b/nodes/within-time-switch.js
@@ -418,12 +418,14 @@ module.exports = function (RED) {
}
this.withinTimeValue = {
value : config.withinTimeValue ? config.withinTimeValue : 'true',
- type : config.withinTimeValueType ? config.withinTimeValueType : 'input'
+ type : config.withinTimeValueType ? config.withinTimeValueType : 'msgInput'
};
+ if (this.withinTimeValue.type === 'input') { this.withinTimeValue.type = 'msgInput'; }
this.outOfTimeValue = {
value : config.outOfTimeValue ? config.outOfTimeValue : 'false',
- type : config.outOfTimeValueType ? config.outOfTimeValueType : 'input'
+ type : config.outOfTimeValueType ? config.outOfTimeValueType : 'msgInput'
};
+ if (this.outOfTimeValueType.type === 'input') { this.outOfTimeValueType.type = 'msgInput'; }
this.timeOutObj = null;
this.lastMsgObj = null;
@@ -458,7 +460,7 @@ module.exports = function (RED) {
msg.withinTime = true;
this.debug('in time [1] - send msg to first output ' + result.startSuffix +
node.positionConfig.toDateTimeString(dNow) + result.endSuffix + ' (' + msg.withinTimeStart.id + ' - ' + cmpNow + ' - ' + msg.withinTimeEnd.id + ')');
- if (node.withinTimeValue.type === 'input') {
+ if (node.withinTimeValue.type === 'msgInput') {
send([msg, null]); // within time
} else {
const resultMsg = RED.util.cloneMessage(msg);
@@ -472,7 +474,7 @@ module.exports = function (RED) {
msg.withinTime = true;
this.debug('in time [2] - send msg to first output ' + result.startSuffix +
node.positionConfig.toDateTimeString(dNow) + result.endSuffix + ' (' + msg.withinTimeStart.id + ' - ' + cmpNow + ' - ' + msg.withinTimeEnd.id + ')');
- if (node.withinTimeValue.type === 'input') {
+ if (node.withinTimeValue.type === 'msgInput') {
send([msg, null]); // within time
} else {
const resultMsg = RED.util.cloneMessage(msg);
@@ -487,7 +489,7 @@ module.exports = function (RED) {
}
msg.withinTime = false;
this.debug('out of time - send msg to second output ' + result.startSuffix + node.positionConfig.toDateTimeString(dNow) + result.endSuffix);
- if (node.outOfTimeValue.type === 'input') {
+ if (node.outOfTimeValue.type === 'msgInput') {
send([null, msg]); // out of time
} else {
const resultMsg = RED.util.cloneMessage(msg);
diff --git a/package.json b/package.json
index 8c82eee..3be176d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-sun-position",
- "version": "2.0.5",
+ "version": "2.0.6",
"description": "NodeRED nodes to get sun and moon position",
"keywords": [
"node-red",
@@ -111,7 +111,7 @@
"lodash.isequal": "^4.5.0"
},
"devDependencies": {
- "eslint": "^8.2.0",
+ "eslint": "^8.3.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-jsdoc": "^37.0.3",
"eslint-plugin-json": "^3.1.0",
From 07c4c61c9006813243a906ed3a0bd70965a74f6e Mon Sep 17 00:00:00 2001
From: Hypnos <12692680+Hypnos3@users.noreply.github.com>
Date: Sun, 28 Nov 2021 00:08:48 +0100
Subject: [PATCH 2/4] implemented #369 , #367 , #362
---
CHANGELOG.md | 12 ++++
nodes/blind-control.html | 26 +++++--
nodes/blind-control.js | 95 ++++++++++++++++----------
nodes/clock-timer.html | 4 +-
nodes/clock-timer.js | 7 +-
nodes/lib/timeControlHelper.js | 5 +-
nodes/locales/de/blind-control.json | 1 +
nodes/locales/en-US/blind-control.json | 1 +
8 files changed, 105 insertions(+), 46 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 004473f..dc3b631 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,18 @@ Install of a specific Version in Redmatic (on a Homematic):
This can be also used to go back to an older Version.
+### 2.0.6: bug fixes
+
+- blind-control + clock-time
+ - reduced default startup delay to may 1s
+ - do output to first output on startup #369
+
+- blind-control
+ - implemented `setSunDataFloorLength` #367
+ - for an oversteer rule can now be configured if it should be active if the sun is in the window (default as previous) #362
+
+- within-time-switch fix error with output value #363
+
### 2.0.5: bug fixes
- clock-time
diff --git a/nodes/blind-control.html b/nodes/blind-control.html
index 94b0081..3b41129 100644
--- a/nodes/blind-control.html
+++ b/nodes/blind-control.html
@@ -1654,6 +1654,7 @@
thresholdType : 'num', // threshold type
threshold : '', // threshold
mode : 0,
+ onlySunInWindow : true,
blindPos : {
type : 'levelFixed',
value : 'open (max)'
@@ -1664,12 +1665,16 @@
}
};
}
+ if (!Object.prototype.hasOwnProperty.call(data, 'onlySunInWindow')) {
+ data.onlySunInWindow = true;
+ }
containerRow.css({overflow: 'hidden', whiteSpace: 'nowrap'});
const $row1 = $('
').appendTo(containerRow);
const $row2 = $('', {style: 'padding-top: 5px;'}).appendTo(containerRow);
const $row3 = $('', {style: 'padding-top: 5px;'}).appendTo(containerRow);
const $row4 = $('', {style: 'padding-top: 5px;'}).appendTo(containerRow);
+ const $row5 = $('', {style: 'padding-top: 5px;'}).appendTo(containerRow);
// row1 - index + oversteerValue + Compare
$('',{
type: 'hidden',
@@ -1798,6 +1803,18 @@
});
setTInputValue($oversteerSlatPos, data.slatPos.value, data.slatPos.type);
+ // row5 - SunInWindow
+ addLabel($row5, 'node-input-oversteer-sunInWindow', 'fa fa-window-maximize', node._('blind-control.label.oversteerSunInWindow'), '255px');
+ const $oversteerOnlySunInWindow = $('', {
+ class: 'node-input-oversteer-sunInWindow',
+ type: 'checkbox'
+ })
+ .css('width', 'auto')
+ .css('margin-left', '10px')
+ .css('margin-top', '0')
+ .appendTo($row5);
+ $oversteerOnlySunInWindow.prop('checked', data.onlySunInWindow);
+
// changes
$oversteerValue.change(() => {
$oversteerThreshold.change();
@@ -3540,6 +3557,7 @@
operatorText : $rule.find('.node-input-oversteer-compare option:selected').text(),
thresholdType : $rule.find('.node-input-oversteer-threshold').typedInput('type'),
threshold : $rule.find('.node-input-oversteer-threshold').typedInput('value'),
+ onlySunInWindow : $rule.find('.node-input-oversteer-sunInWindow').is(':checked'),
blindPos : {
type : $rule.find('.node-input-oversteer-blindPos').typedInput('type'),
value : $rule.find('.node-input-oversteer-blindPos').typedInput('value')
@@ -3678,8 +3696,8 @@
-
-
+
+
@@ -3788,8 +3806,8 @@
-
-
+
+
diff --git a/nodes/blind-control.js b/nodes/blind-control.js
index 8260bf4..0418af9 100644
--- a/nodes/blind-control.js
+++ b/nodes/blind-control.js
@@ -105,27 +105,28 @@ module.exports = function (RED) {
* @param {Object} tempData the temporary data holder object
* @param {ITimeObject} oNow the now Object
*/
- function checkOversteer(node, msg, tempData, oNow) {
+ function checkOversteer(node, msg, tempData, sunPosition, oNow) {
// node.debug(`checkOversteer ${util.inspect(node.oversteers, { colors: true, compact: 10, breakLength: Infinity })}`);
try {
node.oversteer.isChecked = true;
- return node.oversteers.find(el => ((el.mode === 0 || el.mode === node.sunData.mode) && node.positionConfig.comparePropValue(node, msg,
- {
- value: el.value,
- type: el.valueType,
- expr: el.valueExpr,
- callback: (result, _obj) => {
- return ctrlLib.evalTempData(node, _obj.type, _obj.value, result, tempData);
- }
- },
- el.operator,
- {
- value: el.threshold,
- type: el.thresholdType,
- callback: (result, _obj) => {
- return ctrlLib.evalTempData(node, _obj.type, _obj.value, result, tempData);
- }
- }, false, oNow.dNow)));
+ return node.oversteers.find(el => ((el.mode === 0 || el.mode === node.sunData.mode) && (!el.onlySunInWindow || sunPosition.InWindow) &&
+ node.positionConfig.comparePropValue(node, msg,
+ {
+ value: el.value,
+ type: el.valueType,
+ expr: el.valueExpr,
+ callback: (result, _obj) => {
+ return ctrlLib.evalTempData(node, _obj.type, _obj.value, result, tempData);
+ }
+ },
+ el.operator,
+ {
+ value: el.threshold,
+ type: el.thresholdType,
+ callback: (result, _obj) => {
+ return ctrlLib.evalTempData(node, _obj.type, _obj.value, result, tempData);
+ }
+ }, false, oNow.dNow)));
} catch (err) {
node.error(RED._('blind-control.errors.getOversteerData', err));
node.log(util.inspect(err, Object.getOwnPropertyNames(err)));
@@ -336,6 +337,24 @@ module.exports = function (RED) {
}
}
+ if (node.oversteer.active) {
+ const res = checkOversteer(node, msg, tempData, sunPosition, oNow);
+ if (res) {
+ node.level.current = getBlindPosFromTI(node, undefined, res.blindPos.type, res.blindPos.value, node.nodeData.levelTop);
+ node.level.currentInverse = getInversePos_(node, node.level.current);
+ node.level.slat = node.positionConfig.getPropValue(node, msg, res.slatPos, false, oNow.dNow);
+ node.level.topic = node.oversteer.topic;
+ node.previousData.last.sunLevel = node.level.current;
+ node.reason.code = 10;
+ node.reason.state = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.states.oversteer', { pos: res.pos+1 });
+ node.reason.description = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.reasons.oversteer', { pos: res.pos+1 });
+ sunPosition.oversteer = res;
+ sunPosition.oversteerAll = node.oversteers;
+ return sunPosition;
+ }
+ sunPosition.oversteerAll = node.oversteers;
+ }
+
// const summerMode = 2;
if (!sunPosition.InWindow) {
if (node.sunData.mode === cWinterMode) {
@@ -364,24 +383,6 @@ module.exports = function (RED) {
return sunPosition;
}
- if (node.oversteer.active) {
- const res = checkOversteer(node, msg, tempData, oNow);
- if (res) {
- node.level.current = getBlindPosFromTI(node, undefined, res.blindPos.type, res.blindPos.value, node.nodeData.levelTop);
- node.level.currentInverse = getInversePos_(node, node.level.current);
- node.level.slat = node.positionConfig.getPropValue(node, msg, res.slatPos, false, oNow.dNow);
- node.level.topic = node.oversteer.topic;
- node.previousData.last.sunLevel = node.level.current;
- node.reason.code = 10;
- node.reason.state = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.states.oversteer', { pos: res.pos+1 });
- node.reason.description = RED._('node-red-contrib-sun-position/position-config:ruleCtrl.reasons.oversteer', { pos: res.pos+1 });
- sunPosition.oversteer = res;
- sunPosition.oversteerAll = node.oversteers;
- return sunPosition;
- }
- sunPosition.oversteerAll = node.oversteers;
- }
-
if (node.sunData.mode === cWinterMode) {
node.level.current = node.nodeData.levelMax;
node.level.currentInverse = getInversePos_(node, node.level.current);
@@ -888,6 +889,7 @@ module.exports = function (RED) {
thresholdType : 'num',
threshold : config.sunMinAltitude,
mode : 2,
+ onlySunInWindow : true,
blindPos : {
type : config.blindPosDefaultType,
value : config.blindPosDefault
@@ -907,6 +909,7 @@ module.exports = function (RED) {
threshold : config.oversteerThreshold,
thresholdType : config.oversteerThresholdType,
mode : 0,
+ onlySunInWindow : true,
blindPos : {
type : config.oversteerBlindPosType,
value : config.oversteerBlindPos
@@ -924,6 +927,7 @@ module.exports = function (RED) {
threshold : config.oversteer2Threshold,
thresholdType : config.oversteer2ThresholdType,
mode : 0,
+ onlySunInWindow : true,
blindPos : {
type : config.oversteer2BlindPosType,
value : config.oversteer2BlindPos
@@ -941,6 +945,7 @@ module.exports = function (RED) {
threshold : config.oversteer3Threshold,
thresholdType : config.oversteer3ThresholdType,
mode : 0,
+ onlySunInWindow : true,
blindPos : {
type : config.oversteer3BlindPosType,
value : config.oversteer3BlindPos
@@ -979,6 +984,9 @@ module.exports = function (RED) {
node.oversteers = config.oversteers;
node.oversteers.forEach( (val, _index) => {
val.pos = _index;
+ if (!Object.prototype.hasOwnProperty.call(val, 'onlySunInWindow')) {
+ val.onlySunInWindow = true;
+ }
if (node.positionConfig && val.valueType === 'jsonata') {
try {
val.valueExpr = node.positionConfig.getJSONataExpression(node, val.value);
@@ -1108,6 +1116,14 @@ module.exports = function (RED) {
case 'setSunDataTopic':
node.sunData.topic = msg.payload || node.sunData.topic;
break;
+ case 'setSunDataFloorLength': {
+ const val = getFloatValue(node.sunData.floorLength);
+ if (val !== node.sunData.floorLength) {
+ node.sunData.floorLengthType = 'num';
+ node.sunData.floorLength = val;
+ }
+ break;
+ }
/* minimum changes Settings */
case 'setSunDataMinDelta':
node.sunData.minDelta = parseFloat(msg.payload) || node.sunData.minDelta; // payload of 0 makes no sense, use then default
@@ -1310,7 +1326,8 @@ module.exports = function (RED) {
if (topic) {
topic = hlp.topicReplace(topic, replaceAttrs);
}
- if ((!isNaN(node.level.current)) &&
+ if ((!node.startDelayTimeOut) &&
+ (!isNaN(node.level.current)) &&
((node.level.current !== node.previousData.level) ||
(!isEqual(node.level.slat, node.previousData.slat)) ||
(node.level.topic !== node.previousData.topic))) {
@@ -1384,6 +1401,10 @@ module.exports = function (RED) {
clearTimeout(node.autoTriggerObj);
delete node.autoTriggerObj;
}
+ if (node.startDelayTimeOutObj) {
+ clearTimeout(node.startDelayTimeOutObj);
+ delete node.startDelayTimeOutObj;
+ }
// tidy up any state
});
// ####################################################################################################
diff --git a/nodes/clock-timer.html b/nodes/clock-timer.html
index bc63667..ac58b92 100644
--- a/nodes/clock-timer.html
+++ b/nodes/clock-timer.html
@@ -2740,8 +2740,8 @@
-
-
+
+
diff --git a/nodes/clock-timer.js b/nodes/clock-timer.js
index 3dfe825..c07f039 100644
--- a/nodes/clock-timer.js
+++ b/nodes/clock-timer.js
@@ -545,7 +545,8 @@ module.exports = function (RED) {
topic = hlp.topicReplace(topic, replaceAttrs);
}
- if ((typeof node.payload.current !== 'undefined') &&
+ if ((!node.startDelayTimeOut) &&
+ (typeof node.payload.current !== 'undefined') &&
(node.payload.current !== 'none') &&
(node.payload.current !== null) &&
!(isEqual(node.payload.topic, previousData.topic) &&
@@ -621,6 +622,10 @@ module.exports = function (RED) {
clearTimeout(node.autoTriggerObj);
delete node.autoTriggerObj;
}
+ if (node.startDelayTimeOutObj) {
+ clearTimeout(node.startDelayTimeOutObj);
+ delete node.startDelayTimeOutObj;
+ }
// tidy up any state
});
// ####################################################################################################
diff --git a/nodes/lib/timeControlHelper.js b/nodes/lib/timeControlHelper.js
index bbded38..4692d6d 100644
--- a/nodes/lib/timeControlHelper.js
+++ b/nodes/lib/timeControlHelper.js
@@ -764,11 +764,12 @@ function initializeCtrl(REDLib, node, config) {
}
if (node.autoTrigger || (parseFloat(config.startDelayTime) > 9)) {
- let delay = parseFloat(config.startDelayTime) || (2000 + Math.floor(Math.random() * 8000)); // 2s - 10s
+ let delay = parseFloat(config.startDelayTime) || (300 + Math.floor(Math.random() * 700)); // default = 300ms - 1s
delay = Math.min(delay, 2147483646);
node.startDelayTimeOut = new Date(Date.now() + delay);
- setTimeout(() => {
+ node.startDelayTimeOutObj = setTimeout(() => {
delete node.startDelayTimeOut;
+ delete node.startDelayTimeOutObj;
node.emit('input', {
topic: 'autoTrigger/triggerOnly/start',
payload: 'triggerOnly',
diff --git a/nodes/locales/de/blind-control.json b/nodes/locales/de/blind-control.json
index 1c9f23b..da75379 100644
--- a/nodes/locales/de/blind-control.json
+++ b/nodes/locales/de/blind-control.json
@@ -35,6 +35,7 @@
"oversteerBlindPos": "Rollladenposition",
"oversteerSlatPos": "Lamellenposition",
"oversteerTopic":"Übersteuerungs topic",
+ "oversteerSunInWindow": "nur wenn die Sonne ins Fenster scheint",
"smoothTime": "glätten",
"showEnhSettings": "Erweiterte Einstellungen",
"offset": "Zeit offset",
diff --git a/nodes/locales/en-US/blind-control.json b/nodes/locales/en-US/blind-control.json
index 2b45de1..1bd9e5c 100644
--- a/nodes/locales/en-US/blind-control.json
+++ b/nodes/locales/en-US/blind-control.json
@@ -35,6 +35,7 @@
"oversteerBlindPos": "blind position",
"oversteerSlatPos": "slat position",
"oversteerTopic":"oversteer topic",
+ "oversteerSunInWindow": "only when sun shines in the window",
"smoothTime": "smoothTime",
"showEnhSettings": "Enhanced settings",
"offset": "time offset",
From 53a42063216e9bdf7efc436b9b8fb5922de783cf Mon Sep 17 00:00:00 2001
From: Hypnos <12692680+Hypnos3@users.noreply.github.com>
Date: Sun, 28 Nov 2021 00:41:56 +0100
Subject: [PATCH 3/4] time-inject fix for next property #364
---
CHANGELOG.md | 6 ++++--
nodes/blind-control.html | 4 ++--
nodes/static/htmlglobal.js | 4 ++--
nodes/time-inject.js | 8 ++++++++
nodes/within-time-switch.js | 2 +-
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc3b631..613d19c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@ This can be also used to go back to an older Version.
### 2.0.6: bug fixes
+- time-inject fix for next property #364
+
+- within-time-switch fix error with output value #363
+
- blind-control + clock-time
- reduced default startup delay to may 1s
- do output to first output on startup #369
@@ -25,8 +29,6 @@ This can be also used to go back to an older Version.
- implemented `setSunDataFloorLength` #367
- for an oversteer rule can now be configured if it should be active if the sun is in the window (default as previous) #362
-- within-time-switch fix error with output value #363
-
### 2.0.5: bug fixes
- clock-time
diff --git a/nodes/blind-control.html b/nodes/blind-control.html
index 3b41129..088d3d9 100644
--- a/nodes/blind-control.html
+++ b/nodes/blind-control.html
@@ -1723,7 +1723,7 @@
$oversteerCompare.val(data.operator || 'gte');
// row2 - Thersold
- addLabel($row2, 'node-input-oversteer-compare', 'fa fa-cloud', node._('blind-control.label.oversteerThreshold'), '95px');
+ addLabel($row2, 'node-input-oversteer-compare', 'fa fa-cloud', node._('blind-control.label.oversteerThreshold'));
const $oversteerThreshold = $('', {
class: 'node-input-oversteer-threshold',
@@ -1804,7 +1804,7 @@
setTInputValue($oversteerSlatPos, data.slatPos.value, data.slatPos.type);
// row5 - SunInWindow
- addLabel($row5, 'node-input-oversteer-sunInWindow', 'fa fa-window-maximize', node._('blind-control.label.oversteerSunInWindow'), '255px');
+ addLabel($row5, 'node-input-oversteer-sunInWindow', 'fa fa-window-maximize', node._('blind-control.label.oversteerSunInWindow'));
const $oversteerOnlySunInWindow = $('', {
class: 'node-input-oversteer-sunInWindow',
type: 'checkbox'
diff --git a/nodes/static/htmlglobal.js b/nodes/static/htmlglobal.js
index f4fe3cb..7369927 100644
--- a/nodes/static/htmlglobal.js
+++ b/nodes/static/htmlglobal.js
@@ -988,7 +988,7 @@ function initCombobox(node, $inputSelect, $inputBox, dataListID, optionElementNa
* @returns {jQuery} jQuery selector of the new label
*/
function addLabel(parent, forEl, symb, text, width) { // eslint-disable-line no-unused-vars
- const lbl = $('').attr('for', forEl).appendTo(parent);
+ const lbl = $('').attr('for', forEl).appendTo(parent);
if (symb) {
lbl.append('');
}
@@ -997,7 +997,7 @@ function addLabel(parent, forEl, symb, text, width) { // eslint-disable-line no-
lbl.append(span);
// lbl.attr('style', 'margin-left: 5px; width:' + 20 + span.width() + 'px;');
width = width || 'auto';
- lbl.attr('style', 'margin-left: 5px; width:' + width + ';');
+ lbl.attr('style', 'margin-left: 5px; margin-right: 5px; width:' + width + ';');
} else {
width = width || '20px';
lbl.attr('style', 'margin-left: 5px; margin-right: 2px; width:' + width + ';');
diff --git a/nodes/time-inject.js b/nodes/time-inject.js
index dcca9f6..a052e36 100644
--- a/nodes/time-inject.js
+++ b/nodes/time-inject.js
@@ -42,6 +42,14 @@ module.exports = function (RED) {
onlyEvenWeeks: prop.onlyEvenWeeks,
onlyOddWeeks : prop.onlyOddWeeks
};
+ if (propNew.type === 'dateEntered' ||
+ propNew.type === 'dateSpecific' ||
+ propNew.type === 'dayOfMonth') {
+ propNew.next = false;
+ } else if (propNew.type === 'pdsTimeNow') {
+ // next sun time
+ propNew.next = true;
+ }
if (node.positionConfig && propNew.type === 'jsonata') {
try {
diff --git a/nodes/within-time-switch.js b/nodes/within-time-switch.js
index 1707dec..67b6b03 100644
--- a/nodes/within-time-switch.js
+++ b/nodes/within-time-switch.js
@@ -425,7 +425,7 @@ module.exports = function (RED) {
value : config.outOfTimeValue ? config.outOfTimeValue : 'false',
type : config.outOfTimeValueType ? config.outOfTimeValueType : 'msgInput'
};
- if (this.outOfTimeValueType.type === 'input') { this.outOfTimeValueType.type = 'msgInput'; }
+ if (this.outOfTimeValue.type === 'input') { this.outOfTimeValue.type = 'msgInput'; }
this.timeOutObj = null;
this.lastMsgObj = null;
From d940f7eed88f3d89ff0235609418c35831170f27 Mon Sep 17 00:00:00 2001
From: Hypnos <12692680+Hypnos3@users.noreply.github.com>
Date: Sun, 28 Nov 2021 00:54:32 +0100
Subject: [PATCH 4/4] style fixes
---
nodes/blind-control.html | 8 ++++----
nodes/static/htmlglobal.js | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/nodes/blind-control.html b/nodes/blind-control.html
index 088d3d9..33c5418 100644
--- a/nodes/blind-control.html
+++ b/nodes/blind-control.html
@@ -1723,13 +1723,13 @@
$oversteerCompare.val(data.operator || 'gte');
// row2 - Thersold
- addLabel($row2, 'node-input-oversteer-compare', 'fa fa-cloud', node._('blind-control.label.oversteerThreshold'));
+ addLabel($row2, 'node-input-oversteer-compare', 'fa fa-cloud', node._('blind-control.label.oversteerThreshold'), '95px');
const $oversteerThreshold = $('', {
class: 'node-input-oversteer-threshold',
type: 'text'
})
- .css('width', 'calc(100% - 160px)')
+ .css('width', 'calc(100% - 162px)')
.appendTo($row2)
.typedInput({
default: 'num',
@@ -1766,7 +1766,7 @@
class: 'node-input-oversteer-blindPos',
type: 'text'
})
- .css('width', 'calc(100% - 145px)')
+ .css('width', 'calc(100% - 147px)')
.appendTo($row3)
.typedInput({
default: types.LevelFix,
@@ -1779,7 +1779,7 @@
class: 'node-input-oversteer-slatPos',
type: 'text'
})
- .css('width', 'calc(100% - 145px)')
+ .css('width', 'calc(100% - 147px)')
.appendTo($row4)
.typedInput({
default: 'num',
diff --git a/nodes/static/htmlglobal.js b/nodes/static/htmlglobal.js
index 7369927..0ef0bd4 100644
--- a/nodes/static/htmlglobal.js
+++ b/nodes/static/htmlglobal.js
@@ -997,7 +997,7 @@ function addLabel(parent, forEl, symb, text, width) { // eslint-disable-line no-
lbl.append(span);
// lbl.attr('style', 'margin-left: 5px; width:' + 20 + span.width() + 'px;');
width = width || 'auto';
- lbl.attr('style', 'margin-left: 5px; margin-right: 5px; width:' + width + ';');
+ lbl.attr('style', 'margin-left: 5px; margin-right: 2px; width:' + width + ';');
} else {
width = width || '20px';
lbl.attr('style', 'margin-left: 5px; margin-right: 2px; width:' + width + ';');