Socket
Socket
Sign inDemoInstall

node-red-contrib-sun-position

Package Overview
Dependencies
1
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0-beta-2 to 0.3.0-beta-3

images/backup/blind-control-rules-1.png

111

blind_control.md

@@ -11,15 +11,19 @@ # Blind Controller

* [blind-control](#blind-control)
* [Node settings](#node-settings)
* [general](#general)
* [blind settings](#blind-settings)
* [rule settings](#rule-settings)
* [overwrite settings](#overwrite-settings)
* [sun settings](#sun-settings)
* [maximize sunlight (Winter)](#maximize-sunlight--winter-)
* [restrict sunlight (Summer)](#restrict-sunlight--summer-)
* [Node Input](#node-input)
* [Node Output](#node-output)
* [Node Status](#node-status)
* [Samples](#samples)
* [Blind Controller](#blind-controller)
* [blind-control](#blind-control)
* [Table of contents](#table-of-contents)
* [Node settings](#node-settings)
* [general](#general)
* [blind settings](#blind-settings)
* [rule settings](#rule-settings)
* [overwrite settings](#overwrite-settings)
* [sun settings](#sun-settings)
* [maximize sunlight (Winter)](#maximize-sunlight-winter)
* [restrict sunlight (Summer)](#restrict-sunlight-summer)
* [Node Input](#node-input)
* [Node Output](#node-output)
* [Node Status](#node-status)
* [rules](#rules)
* [rules example](#rules-example)
* [Samples](#samples)

@@ -54,13 +58,13 @@ ### Node settings

* If a rule applies, the blind position defined by the rule will be used.
* sun control will then not be active
* If a rule has a condition, the rule only applies if the condition matches.
* For some conditions a comparisons needs to be defined.
* If the values of comparison comes from a message object and the value can not be determined, the value is taken at which the value could be determined last. If there is no previous value a error will be thrown otherwise only a log output. To thus the message property not needs to be available in all incoming messages.
* If a rule has a time limitation
* `until` the first rule is taken, where the given time is greater than the current time.
* `from` the last rule is taken, where the given time is less than the current time.
* If a rule applies, the blind position defined by the rule will be used.
* sun control will then not be active
* If a rule has a condition, the rule only applies if the condition matches.
* For some conditions a comparisons needs to be defined.
* If the values of comparison comes from a message object and the value can not be determined, the value is taken at which the value could be determined last. If there is no previous value a error will be thrown otherwise only a log output. To thus the message property not needs to be available in all incoming messages.
* If a rule has a time limitation
* `until` the first rule is taken, where the given time is greater than the current time.
* `from` the last rule is taken, where the given time is less than the current time.
* For some time definitions an Offset could be added (or be reduced with a negative value)
* If for the blind position a value from a message object and the value can not be determined the defined default blind position will be used.
* For some time definitions an Offset could be added (or be reduced with a negative value)
* If for the blind position a value from a message object and the value can not be determined the defined default blind position will be used.

@@ -84,5 +88,6 @@ #### overwrite settings

The sun control (maximize or restrict sunlight) is only active, if no other rule or override matches.
* Requirements that should be valid with a higher priority should be set up as rules.
* Example: if the blind should set to a level if a temperature threshold exceeded, this could be setup as rule
* Requirements that should be valid with a higher priority should be set up as rules.
* Example: if the blind should set to a level if a temperature threshold exceeded, this could be setup as rule
##### maximize sunlight (Winter)

@@ -120,7 +125,7 @@

![blind-control-settings-8](https://user-images.githubusercontent.com/12692680/57134470-8da65e00-6da6-11e9-95a9-41eab8f6a6d3.png)
![blind-control-settings-8](https://user-images.githubusercontent.com/12692680/57453633-2df8f880-7267-11e9-85be-721ca916d2b1.png)
![blind-control-settings-9](https://user-images.githubusercontent.com/12692680/57134453-8c753100-6da6-11e9-9285-74e98e17f62b.png)
![blind-control-settings-9](https://user-images.githubusercontent.com/12692680/57453639-30f3e900-7267-11e9-9fbe-6688d075b988.png)
* **oversteer**, **oversteer Operator**, **Threshold** allows to define a blind position which should be used in a given condition to be used instead of the calculated value by the sun. Typical use-case is a weather condition but it is not limited to that.
* **oversteer**, **oversteer Operator**, **Threshold** allows to define a blind position which should be used in a given [condition](README.md#conditions) to be used instead of the calculated value by the sun. Typical use-case is a weather condition but it is not limited to that.
* the value for **Threshold** can only be entered if needed by selected **operator**

@@ -227,2 +232,48 @@ * Example: If the **oversteer** is a property which contains a numerical value representing the percentage of sky occluded by clouds and an operator *greater than or equal* is used with a **Threshold** a numerical value representing the maximum percentage of sky occluded by clouds. Then if the **oversteer** value exceeds the **Threshold** the **blind position** will be used instead of the position calculated by the sun.

## rules
The rules are not easy to understand.
There are basically 4 types of rules:
* absolute rule
* a rule with no time and no condition will be absolute. If such a rule is the first rule, no other rule will be active, no sun control will be done
* such rules not really makes sense
* a rule with a condition - conditional rule
* a rule with a condition will only be active if the condition matches, otherwise the rule will be ignored
* a rule with a given time - time rule
* time rules differ again in 2 ways
* __to__ time rules
* __from__ time rules
* a rule with a condition and a given time
* these type of rules are a combination. The rules will only be considered if the condition matches and then it act as a normal time rule. Otherwise it will be ignored.
### rules example
first lets look at the until rules:
![blind-control-rules-1](https://user-images.githubusercontent.com/12692680/57451580-018ead80-7262-11e9-9630-2662bdfdc627.png)
starting from midnight the following rule will be used:
* *until* 6:30 the rule 1 which results in a blind position of closed
* *until* 7:25 the rule 2 which results in a blind position of closed
* but only if the [condition](README.md#conditions) "global.dayInfo.isWeekendOrHoliday === true" matches
* *until* civilDawn ~9:24 the rule 3 which results in a blind position of closed
* but only if the time of civilDawn is greater than a time of a previous *until* rule
then lets look at the from rules:
![blind-control-rules-2](https://user-images.githubusercontent.com/12692680/57451583-03f10780-7262-11e9-8561-2bae3cf7d3cd.png)
starting from a defined time the following rule will be used:
* *from* civilDusk ~23:05 the rule 4 which results in a blind position of closed
* but only if the time of civilDusk is lower than a time of a following *from* rule
* *from* 22:35 the rule 5 which results in a blind position of closed
* but only if the [condition](README.md#conditions) "global.dayInfo.isWeekendOrHoliday === false" matches
* *from* 23:15 the rule 6 which results in a blind position of closed
This position will be used until midnight
There is a time between the *until* and the *from* rules, where no rules matches. In this time the default defined blind position will be used or if sun control is active the blind position calculated by the sun will be used.
## Samples

@@ -235,3 +286,3 @@

```json
[{"id":"955111e1.50585","type":"blind-control","z":"d7bd7fb6.a0c13","name":"","topic":"","positionConfig":"650223e.daba8dc","outputs":"1","blindIncrement":0.01,"blindOpenPos":1,"blindClosedPos":0,"blindPosReverse":false,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","overwriteExpire":"7200000","rules":[{"timeType":"entered","timeValue":"6:00","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDawn","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDusk","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"entered","timeValue":"23:00","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""}],"tsCompare":"0","sunControlMode":"0","sunFloorLength":"","sunMinAltitude":"","blindPosMin":"closed (min)","blindPosMinType":"levelFixed","blindPosMax":"open (max)","blindPosMaxType":"levelFixed","smoothTime":"","windowTop":"","windowBottom":"","windowAzimuthStart":"","windowAzimuthEnd":"","oversteerValue":"","oversteerValueType":"none","oversteerCompare":"gte","oversteerThreshold":"","oversteerThresholdType":"num","oversteerBlindPos":"open (max)","oversteerBlindPosType":"levelFixed","x":440,"y":2385,"wires":[["afa7898a.2362b8"]]},{"id":"dc2734a.e0332c8","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":false,"onceDelay":0.1,"x":235,"y":2385,"wires":[["955111e1.50585"]]},{"id":"afa7898a.2362b8","type":"debug","z":"d7bd7fb6.a0c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":655,"y":2385,"wires":[]},{"id":"650223e.daba8dc","type":"position-config","z":"","name":"","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timezoneOffset":-60}]
[{"id":"c4660958.801288","type":"blind-control","z":"d7bd7fb6.a0c13","name":"","topic":"","positionConfig":"650223e.daba8dc","outputs":"1","blindIncrement":0.01,"blindOpenPos":1,"blindClosedPos":0,"blindPosReverse":false,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","overwriteExpire":"7200000","rules":[{"timeType":"entered","timeValue":"6:00","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDawn","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDusk","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""},{"timeType":"entered","timeValue":"23:00","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"num","validOperandBValue":""}],"sunControlMode":"0","sunFloorLength":"","sunMinAltitude":"","blindPosMin":"closed (min)","blindPosMinType":"levelFixed","blindPosMax":"open (max)","blindPosMaxType":"levelFixed","smoothTime":"","windowTop":"","windowBottom":"","windowAzimuthStart":"","windowAzimuthEnd":"","oversteerValue":"","oversteerValueType":"none","oversteerCompare":"gte","oversteerThreshold":"","oversteerThresholdType":"num","oversteerBlindPos":"open (max)","oversteerBlindPosType":"levelFixed","x":415,"y":3135,"wires":[["51d5763f.b879e8"]]},{"id":"8a367fde.6639","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":3135,"wires":[["c4660958.801288"]]},{"id":"51d5763f.b879e8","type":"debug","z":"d7bd7fb6.a0c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":3135,"wires":[]},{"id":"c0eac267.02eb8","type":"comment","z":"d7bd7fb6.a0c13","name":"Example 1:","info":"","x":150,"y":3090,"wires":[]},{"id":"650223e.daba8dc","type":"position-config","z":"","name":"","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timezoneOffset":-60}]
```

@@ -242,3 +293,3 @@

```json
[{"id":"65945da6.f4c7d4","type":"blind-control","z":"d7bd7fb6.a0c13","name":"","topic":"","positionConfig":"d2b0ae0f.90e0c","outputs":1,"blindIncrement":"0.01","blindOpenPos":"1","blindClosedPos":0,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","overwriteExpire":"14400000","rules":[{"timeType":"entered","timeValue":"6:30","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""},{"timeType":"entered","timeValue":"7:25","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"global","validOperandAValue":"dayInfo.today.isWeekendOrHoliday","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDawn","timeOp":"0","timeOpText":"until","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""},{"timeType":"pdsTime","timeValue":"civilDusk","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""},{"timeType":"entered","timeValue":"22:35","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"none","validOperandAValue":"","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""},{"timeType":"entered","timeValue":"23:15","timeOp":"1","timeOpText":"from","levelType":"levelFixed","levelValue":"closed (min)","offsetType":"none","offsetValue":"","multiplier":"1","validOperandAType":"global","validOperandAValue":"dayInfo.tomorrow.isWeekendOrHoliday","validOperator":"true","validOperatorText":"is true","validOperandBType":"str","validOperandBValue":""}],"tsCompare":"0","sunControlMode":"0","sunFloorLength":"","sunMinAltitude":"","blindPosMin":"closed (min)","blindPosMinType":"levelFixed","blindPosMax":"open (max)","blindPosMaxType":"levelFixed","smoothTime":"","windowTop":"","windowBottom":"","windowAzimuthStart":"","windowAzimuthEnd":"","oversteerValue":"","oversteerValueType":"none","oversteerCompare":"gte","oversteerThreshold":"50","oversteerThresholdType":"num","oversteerBlindPos":"open (max)","oversteerBlindPosType":"levelFixed","x":440,"y":2445,"wires":[["b833cc54.55162"]]},{"id":"c3adc7de.37c938","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":false,"onceDelay":0.1,"x":235,"y":2445,"wires":[["65945da6.f4c7d4"]]},{"id":"b833cc54.55162","type":"debug","z":"d7bd7fb6.a0c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":655,"y":2445,"wires":[]},{"id":"d2b0ae0f.90e0c","type":"position-config","z":"","name":"Kap-Halbinsel","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timezoneOffset":"1"}]
[{"id":"42177438.2b8acc","type":"blind-control","z":"d7bd7fb6.a0c13","name":"","topic":"","positionConfig":"d2b0ae0f.90e0c","outputs":1,"blindIncrement":"0.01","blindOpenPos":"1","blindClosedPos":0,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","overwriteExpire":"14400000","rules":[{"timeValue":"6:30","timeType":"entered","timeOp":"0","timeOpText":"bis","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"","validOperandAType":"none","validOperator":"true","validOperatorText":"ist wahr","validOperandBValue":"","validOperandBType":"str"},{"timeValue":"7:25","timeType":"entered","timeOp":"0","timeOpText":"bis","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"dayInfo.today.isWeekendOrHoliday","validOperandAType":"global","validOperator":"true","validOperatorText":"ist wahr","validOperandBValue":"","validOperandBType":"str"},{"timeValue":"civilDawn","timeType":"pdsTime","timeOp":"0","timeOpText":"bis","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"","validOperandAType":"none","validOperator":"true","validOperatorText":"ist wahr","validOperandBValue":"","validOperandBType":"str"},{"timeValue":"civilDusk","timeType":"pdsTime","timeOp":"1","timeOpText":"von","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"","validOperandAType":"none","validOperator":"true","validOperatorText":"ist wahr","validOperandBValue":"","validOperandBType":"str"},{"timeValue":"22:35","timeType":"entered","timeOp":"1","timeOpText":"von","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"dayInfo.tomorrow.isWeekendOrHoliday","validOperandAType":"global","validOperator":"false","validOperatorText":"ist falsch","validOperandBValue":"","validOperandBType":"str"},{"timeValue":"23:15","timeType":"entered","timeOp":"1","timeOpText":"von","levelValue":"closed (min)","levelType":"levelFixed","offsetValue":"","offsetType":"none","multiplier":"1","validOperandAValue":"","validOperandAType":"none","validOperator":"true","validOperatorText":"ist wahr","validOperandBValue":"","validOperandBType":"str"}],"sunControlMode":"0","sunFloorLength":"","sunMinAltitude":"","blindPosMin":"closed (min)","blindPosMinType":"levelFixed","blindPosMax":"open (max)","blindPosMaxType":"levelFixed","smoothTime":"","windowTop":"","windowBottom":"","windowAzimuthStart":"","windowAzimuthEnd":"","oversteerValue":"","oversteerValueType":"none","oversteerCompare":"gte","oversteerThreshold":"50","oversteerThresholdType":"num","oversteerBlindPos":"open (max)","oversteerBlindPosType":"levelFixed","x":415,"y":3300,"wires":[["98c3eea0.6fb4b"]]},{"id":"8ad0c281.16c04","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":3300,"wires":[["42177438.2b8acc"]]},{"id":"98c3eea0.6fb4b","type":"debug","z":"d7bd7fb6.a0c13","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":3300,"wires":[]},{"id":"75d33e8e.0d3f6","type":"comment","z":"d7bd7fb6.a0c13","name":"Example 2:","info":"","x":150,"y":3255,"wires":[]},{"id":"49b7db3c.bbdb44","type":"change","z":"d7bd7fb6.a0c13","name":"dayInfo.today.isWeekendOrHoliday","rules":[{"t":"set","p":"dayInfo.today.isWeekendOrHoliday","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":605,"y":3360,"wires":[[]]},{"id":"cfb7c3ce.8f545","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":335,"y":3360,"wires":[["49b7db3c.bbdb44"]]},{"id":"a434dc44.c4da2","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":335,"y":3405,"wires":[["49b7db3c.bbdb44"]]},{"id":"c96a8cf.1e6ea7","type":"change","z":"d7bd7fb6.a0c13","name":"dayInfo.tomorrow.isWeekendOrHoliday","rules":[{"t":"set","p":"dayInfo.tomorrow.isWeekendOrHoliday","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":615,"y":3450,"wires":[[]]},{"id":"d23986f5.6512c8","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":335,"y":3450,"wires":[["c96a8cf.1e6ea7"]]},{"id":"5b57030c.952d9c","type":"inject","z":"d7bd7fb6.a0c13","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":335,"y":3495,"wires":[["c96a8cf.1e6ea7"]]},{"id":"d2b0ae0f.90e0c","type":"position-config","z":"","name":"Kap-Halbinsel","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timezoneOffset":"1"}]
```

@@ -245,0 +296,0 @@

@@ -509,3 +509,4 @@ /********************************************

}
rule.conditonData.operatorText = RED._('node-red-contrib-sun-position/position-config:common.comparators.' + rule.validOperator);
rule.conditonData.operatorText = rule.validOperatorText;
rule.conditonData.operatorDescription = RED._('node-red-contrib-sun-position/position-config:common.comparatorDescription.' + rule.validOperator);
rule.conditonData.text = rule.conditonData.operandAName + ' ' + rule.conditonData.operatorText;

@@ -586,2 +587,3 @@ rule.conditonData.textShort = hlp.clipValueLength(rule.conditonData.operandAName,25) + ' ' + rule.conditonData.operatorText;

data.operatorText = ruleSel.conditonData.operatorText;
data.operatorDescription = ruleSel.conditonData.operatorDescription;
name = 'ruleCond';

@@ -588,0 +590,0 @@ }

@@ -27,2 +27,3 @@ /********************************************

getTimeNumber,
getTimeNumberUTC,
getNodeId,

@@ -308,5 +309,13 @@ initializeParser,

function getTimeNumber(date) {
return date.getMilliseconds() + date.getSeconds() * 1000 + date.getMinutes() * 60000 + date.getHours() * 3600000;
}
/**
* convert the time part of a date into a comparable number
* @param {Date} date - date to convert
* @return {number} numeric representation of the time part of the date
*/
function getTimeNumberUTC(date) {
return date.getUTCMilliseconds() + date.getUTCSeconds() * 1000 + date.getUTCMinutes() * 60000 + date.getUTCHours() * 3600000;
}
/*******************************************************************************************************/

@@ -313,0 +322,0 @@ /**

@@ -7,4 +7,4 @@ {

"json": "json",
"jsonata": "json Ausdr.",
"timestamp": "Zeitmarke",
"jsonata": "jsonata Ausdr.",
"timestamp": "Zeitpunkt",
"blank": "\"\"",

@@ -18,7 +18,8 @@ "nothing": "nichts",

"undefined": "nicht verwendet",
"datespecific": "Zeitmarke (erweitert)",
"datespecific": "Zeitpunkt (erweitert)",
"timeentered": "Uhrzeit (nächste)",
"dateentered": "Datum (Zeitpunkt)",
"timepredefined": "Uhrzeit speziell",
"dayofmonth": "Spezieller Monatstag",
"dayofmonth": "Monatstag",
"dayofweek": "Wochentag",
"timesun": "Uhrzeit Sonnenstand",

@@ -35,3 +36,3 @@ "timemoon": "Uhrzeit Mond Auf/Untergang",

"operatorsGroups": [
"kompletter Zeitstempel"
"kompletter Zeitpunkt"
],

@@ -75,3 +76,3 @@ "operators": [

"lokale Zeit",
"lokale Zeit enh.",
"lokale Zeit erw.",
"lokales Datum",

@@ -113,4 +114,4 @@ "lokales Datum lang",

"outputTSFormatsGroups": [
"Zeitmarke (Zahl)",
"Zeitmarke gerundet (Zahl)",
"Zeitpunkt (Zahl)",
"Zeitpunkt gerundet (Zahl)",
"Text"

@@ -171,4 +172,4 @@ ],

"comparator": [
"ist wahr",
"ist falsch",
"ist true",
"ist false",
"ist null",

@@ -178,13 +179,15 @@ "ist nicht null",

"ist nicht leer",
"ist ein wahr Ausdruck (true, on, wahr, 1)",
"ist ein falsch Ausdruck (false, off, falsch, 0)",
"ist kein wahr Ausdruck (true, on, wahr, 1)",
"ist kein falsch Ausdruck (false, off, falsch, 0)",
"gleich",
"ungleich",
"kleiner als",
"kleiner oder gleich",
"größer",
"größer oder gleich",
"enthält"
"ist wahr/true/on/1",
"ist falsch/false/off/0",
"ist nicht wahr/true/on/1",
"ist nicht falsch/false/off/0",
"=",
"!=",
"<",
"<=",
">",
">=",
"enthält",
"enthält irgendeins",
"enthält alle"
],

@@ -216,5 +219,5 @@

],
"comparators" : {
"true": "ist wahr",
"false": "ist falsch",
"comparatorDescription" : {
"true": "ist Boolean wahr",
"false": "ist Boolean falsch",
"null": "ist null",

@@ -224,13 +227,15 @@ "nnull": "ist nicht null",

"nempty": "ist nicht empty",
"true_expr": "ist wahr*",
"false_expr": "ist falsch*",
"ntrue_expr": "ist nicht wahr*",
"nfalse_expr": "ist nicht falsch*",
"equal": "=",
"nequal": "!=",
"lt": "<",
"lte": "<=",
"gt": ">",
"gte": ">=",
"contain": "enthält"
"true_expr": "ist wahr (true, on, wahr, 1)",
"false_expr": "ist falsch (false, off, 0)",
"ntrue_expr": "ist nicht wahr (true, on, 1)",
"nfalse_expr": "ist nicht falsch (false, off, 0)",
"equal": "gleich",
"nequal": "ungleich",
"lt": "kleiner als",
"lte": "kleiner oder gleich",
"gt": "größer",
"gte": "größer oder gleich",
"contain": "enthält",
"containSome": "enthält irgendeins",
"containEvery": "enthält alle"
}

@@ -243,6 +248,6 @@ },

"warn-init": "Warnung '__message__', wiederhole in __time__min",
"pos-config": "Node ist nicht richtig konfiguriert!! Fehlende oder flasche positionsangaben!",
"pos-config": "Node ist nicht richtig konfiguriert!! Fehlende oder falsche positionsangaben!",
"pos-config-state": "Node ist nicht richtig konfiguriert!!",
"unknownPropertyOperator": "Fehler, der verwendete Operator __propertyOp__=\"__propertyOpText__\" ist unbekannt!",
"unknownCompareOperator": "Fehler, der verwendete vergleichs Operator \"__operator__\" ist unbekannt!",
"unknownCompareOperator": "Fehler, der verwendete vergleichs-Operator \"__operator__\" ist unbekannt!",
"notEvaluableProperty":"Fehler: kann den Wert von __type__.__value__ nicht ermitteln",

@@ -249,0 +254,0 @@ "notEvaluablePropertyDefault": "Fehler: kann den Wert von __type__.__value__ nicht ermitteln, verwende \"__usedValue__\"!",

@@ -22,2 +22,3 @@ {

"dayofmonth":"day of month",
"dayofweek":"day of week",
"timesun":"sun time",

@@ -173,13 +174,15 @@ "timemoon":"moon time",

"is not empty",
"is a true expression (true, on, 1)",
"is a false expression (false, off, 0)",
"is not a true expression",
"is not a false expression",
"equal",
"not equal",
"less than",
"less than or equal",
"greater than",
"greater than or equal",
"contain"
"is true expr.",
"is false expr.",
"is not true expr.",
"is not false expr.",
"==",
"!=",
"<",
"<=",
">",
">=",
"contain",
"containSome",
"containEvery"
],

@@ -224,3 +227,3 @@ "days": [

},
"comparators" : {
"comparatorDescription" : {
"true": "is true",

@@ -232,13 +235,15 @@ "false": "is false",

"nempty": "is not empty",
"true_expr": "is true*",
"false_expr": "is false*",
"ntrue_expr": "is not true*",
"nfalse_expr": "is not false*",
"equal": "=",
"nequal": "!=",
"lt": "<",
"lte": "<=",
"gt": ">",
"gte": ">=",
"contain": "contain"
"true_expr": "is a true expression (true, on, 1)",
"false_expr": "is a false expression (false, off, 0)",
"ntrue_expr": "is not a true expression",
"nfalse_expr": "is not a false expression",
"equal": "equal",
"nequal": "not equal",
"lt": "less than",
"lte": "less than or equal",
"gt": "greater than",
"gte": "greater than or equal",
"contain": "contain",
"containSome": "containSome",
"containEvery": "containEvery"
}

@@ -245,0 +250,0 @@ },

@@ -452,2 +452,9 @@ /********************************************

return msg.value;
} else if (type === 'DayOfMonth') {
const d = new Date();
const nd = hlp.getSpecialDayOfMonth(d.getFullYear(),d.getMonth(), value);
if (nd === null) {
return false;
}
return (nd.getDate() === d.getDate());
}

@@ -525,3 +532,13 @@ opData = RED.util.evaluateNodeProperty(value, type, _srcNode, msg);

case 'contain':
return ((a + '').indexOf(opVal(opTypeB, opValueB, opNameB)) !== -1);
return ((a + '').includes(opVal(opTypeB, opValueB, opNameB)));
case 'containSome': {
const vals = opVal(opTypeB, opValueB, opNameB).split(/,;\|/);
const txt = (a + '');
return vals.some(v => txt.includes(v));
}
case 'containEvery': {
const vals = opVal(opTypeB, opValueB, opNameB).split(/,;\|/);
const txt = (a + '');
return vals.every(v => txt.includes(v));
}
default:

@@ -767,2 +784,4 @@ _srcNode.error(RED._('errors.unknownCompareOperator', { operator: compare }));

RED.httpAdmin.get('/sun-position/data', RED.auth.needsPermission('sun-position.read'), (req, res) => {
console.log('getting request');
console.log(req);
if (req.query.config && req.query.config !== '_ADD_') {

@@ -774,4 +793,4 @@ const posConfig = RED.nodes.getNode(req.query.config);

}
const obj = {};
switch (req.query.type) {
let obj = {};
switch (req.query.kind) {
case 'getFloatProp': {

@@ -789,3 +808,3 @@ try {

try {
obj.value = posConfig.getTimeProp(posConfig, undefined, req.query.type, req.query.valueoffset, req.query.offsetType, req.query.multiplier, req.query.next, req.query.days);
obj = posConfig.getTimeProp(posConfig, undefined, req.query.type, req.query.value, req.query.offset, req.query.offsetType, req.query.multiplier, req.query.next, req.query.days);
} catch(err) {

@@ -798,5 +817,5 @@ obj.value = NaN;

}
case 'getDateFromProp': {
case 'getDateProp': {
try {
obj.value = posConfig.getDateFromProp(posConfig, undefined, req.query.type, req.query.format, req.query.valueoffset, req.query.offsetType, req.query.multiplier);
obj = posConfig.getDateFromProp(posConfig, undefined, req.query.type, req.query.value, req.query.format, req.query.offset, req.query.offsetType, req.query.multiplier);
} catch(err) {

@@ -803,0 +822,0 @@ obj.value = NaN;

@@ -119,3 +119,5 @@ /************************************************************************/

{ id: 'gte', group: 'compare', label: 'greater than or equal', operatorCount: 2 },
{ id: 'contain', group: 'enhanced', label: 'contain', operatorCount: 2 }
{ id: 'contain', group: 'enhanced', label: 'contain', operatorCount: 2 },
{ id: 'containSome', group: 'enhanced', label: 'containSome', operatorCount: 2 },
{ id: 'containEvery', group: 'enhanced', label: 'containEvery', operatorCount: 2 }
]

@@ -227,2 +229,3 @@ };

icon: 'icons/node-red-contrib-sun-position/inputTypeSunClock.png',
hasValue: false,
options: [ 'astronomicalDawn', 'amateurDawn', 'nauticalDawn', 'blueHourDawnStart', 'civilDawn', 'blueHourDawnEnd',

@@ -236,2 +239,3 @@ 'sunrise', 'sunriseEnd', 'goldenHourEnd', 'solarNoon', 'goldenHourStart', 'sunsetStart', 'sunset', 'blueHourDuskStart',

icon: 'icons/node-red-contrib-sun-position/inputTypeMoonClock.png',
hasValue: false,
options: ['rise', 'set']

@@ -464,4 +468,4 @@ },

function setupTInput(node, data) { // eslint-disable-line no-unused-vars
const tInputField = $('#node-input-' + data.valueProp);
const typeField = $('#node-input-' + data.typeProp);
const $inputField = $('#node-input-' + data.valueProp);
const $typeField = $('#node-input-' + data.typeProp);
if (typeof node[data.typeProp] === 'undefined' ||

@@ -471,6 +475,6 @@ node[data.typeProp] === null) {

node[data.typeProp] = data.defaultType;
typeField.val(data.defaultType);
$typeField.val(data.defaultType);
}
} else {
typeField.val(node[data.typeProp]);
$typeField.val(node[data.typeProp]);
}

@@ -481,21 +485,24 @@ if (typeof node[data.valueProp] === 'undefined' ||

node[data.valueProp] = data.defaultValue;
tInputField.val(node[data.defaultValue]);
$inputField.val(node[data.defaultValue]);
}
} else {
tInputField.val(node[data.valueProp]);
$inputField.val(node[data.valueProp]);
}
tInputField.typedInput({
typeField: typeField,
$inputField.typedInput({
typeField: $typeField,
types: data.types
});
if (data.tooltip) {
$inputField.$attr('title', data.tooltip);
}
if (data.width) {
tInputField.typedInput('width', data.width);
$inputField.typedInput('width', data.width);
}
if (data.onChange) {
tInputField.on('change', data.onChange);
$inputField.on('change', data.onChange);
}
if (data.onFocus) {
tInputField.on('change focus focusin focusout', data.onFocus);
$inputField.on('change focus focusin focusout', data.onFocus);
}
return tInputField;
return $inputField;
}

@@ -676,2 +683,49 @@

return multiselect;
}
function getFloatProp(result, config, type, value) { // eslint-disable-line no-unused-vars
const url = '/sun-position/data?config=' + config + '&kind=getFloatProp&type=' + type + '&value=' + value;
$.getJSON(url, result );
}
function getTimeProp(result, config, type, value, offset, offsetType, multiplier, next, days) { // eslint-disable-line no-unused-vars
if (type === 'none' || type === '' || type === 'json' || type === 'jsonata' || type === 'bin') {
result({ value: ''});
} else if (type === 'num' || type === 'str' || type === 'bool') {
result({ value: value });
} else if (type === 'msg' || type === 'flow' || type === 'global' || type === 'env') {
result({ value: type + '.' + value });
} else if (type === 'msgPayload') {
result({ value: 'msg.payload' });
} else if (type === 'msgTs') {
result({ value: 'msg.ts' });
} else if (type === 'msgLC') {
result({ value: 'msg.lc' });
} else if (type === 'msgValue') {
result({ value: 'msg.value' });
} else if (type === 'msgDelay') {
result({ value: 'msg.delay' });
} else if (type === 'msgOnTime') {
result({ value: 'msg.onTime' });
} else if (type === 'msgRampTime') {
result({ value: 'msg.rampTime' });
} else {
let url = '/sun-position/data?config=' + config + '&kind=getTimeProp&type=' + type + '&value=' + value;
if (offset) { url += '&offset=' + offset; }
if (offsetType) { url += '&offsetType=' + offsetType; }
if (multiplier) { url += '&multiplier=' + multiplier; }
if (next) { url += '&next=' + next; }
if (days) { url += '&days=' + days; }
$.getJSON(url, result);
}
}
function getDateProp(result, config, type, value, format, offset, offsetType, multiplier) { // eslint-disable-line no-unused-vars
let url = '/sun-position/data?config=' + config + '&kind=getDateProp&type=' + type + '&value=' + value;
if (format) { url += '&format=' + format; }
if (offset) { url += '&offset=' + offset; }
if (offsetType) { url += '&offsetType=' + offsetType; }
if (multiplier) { url += '&multiplier=' + multiplier; }
$.getJSON(url, result);
}

@@ -228,5 +228,5 @@ /********************************************

const startNr = hlp.getTimeNumber(result.start.value);
const endNr = hlp.getTimeNumber(result.end.value);
const cmpNow = hlp.getTimeNumber(now);
const startNr = hlp.getTimeNumberUTC(result.start.value);
const endNr = hlp.getTimeNumberUTC(result.end.value);
const cmpNow = hlp.getTimeNumberUTC(now);
const status = (config.statusOut || 3);

@@ -233,0 +233,0 @@ if (startNr < endNr) {

{
"name": "node-red-contrib-sun-position",
"version": "0.3.0-beta-2",
"version": "0.3.0-beta-3",
"description": "NodeRED nodes to get sun and moon position",

@@ -5,0 +5,0 @@ "keywords": [

@@ -25,43 +25,46 @@ # node-red-contrib-sun-position for NodeRED

### Table of contents
## Table of contents
* [Installation](#installation)
* [Quick Start](#quick-start)
* [General](#general)
* [Saving resources](#saving-resources)
* [second based accuracy](#second-based-accuracy)
* [Implemented Nodes](#implemented-nodes)
* [sun-position](#sun-position)
* [sun-position - Node settings](#sun-position---node-settings)
* [Node Input](#node-input)
* [sun-position - Node Output](#sun-position---node-output)
* [moon-position](#moon-position)
* [moon-position - Node settings](#moon-position---node-settings)
* [moon-position - Node Output](#moon-position---node-output)
* [time-inject](#time-inject)
* [time-inject - Node settings](#time-inject---node-settings)
* [time-inject - Node Input](#time-inject---node-input)
* [time-inject - Node Output](#time-inject---node-output)
* [within-time](#within-time)
* [within-time - Node settings](#within-time---node-settings)
* [time-comp](#time-comp)
* [time-comp - Node settings](#time-comp---node-settings)
* [time-span](#time-span)
* [time-span - Node settings](#time-span---node-settings)
* [blind-control](#blind-control)
* [Times definitions](#times-definitions)
* [sun times](#sun-times)
* [remarks](#remarks)
* [blue hour](#blue-hour)
* [amateurDawn /amateurDusk](#amateurdawn--amateurdusk)
* [alternate properties](#alternate-properties)
* [moon times](#moon-times)
* [message, flow or global property or JSONATA expression](#message--flow-or-global-property-or-jsonata-expression)
* [input parse formats](#input-parse-formats)
* [output timestamp formats](#output-timestamp-formats)
* [output timespan formats](#output-timespan-formats)
* [TODO](#todo)
* [Bugs and Feedback](#bugs-and-feedback)
* [LICENSE](#license)
* [Other](#other)
* [node-red-contrib-sun-position for NodeRED](#node-red-contrib-sun-position-for-nodered)
* [Table of contents](#table-of-contents)
* [Installation](#installation)
* [Quick Start](#quick-start)
* [General](#general)
* [Saving resources](#saving-resources)
* [second based accuracy](#second-based-accuracy)
* [Implemented Nodes](#implemented-nodes)
* [sun-position](#sun-position)
* [sun-position - Node settings](#sun-position---node-settings)
* [Node Input](#node-input)
* [sun-position - Node Output](#sun-position---node-output)
* [moon-position](#moon-position)
* [moon-position - Node settings](#moon-position---node-settings)
* [moon-position - Node Output](#moon-position---node-output)
* [time-inject](#time-inject)
* [time-inject - Node settings](#time-inject---node-settings)
* [time-inject - Node Input](#time-inject---node-input)
* [time-inject - Node Output](#time-inject---node-output)
* [within-time](#within-time)
* [within-time - Node settings](#within-time---node-settings)
* [time-comp](#time-comp)
* [time-comp - Node settings](#time-comp---node-settings)
* [time-span](#time-span)
* [time-span - Node settings](#time-span---node-settings)
* [blind-control](#blind-control)
* [Times definitions](#times-definitions)
* [sun times](#sun-times)
* [remarks](#remarks)
* [blue hour](#blue-hour)
* [amateurDawn /amateurDusk](#amateurdawn-amateurdusk)
* [alternate properties](#alternate-properties)
* [moon times](#moon-times)
* [message, flow or global property or JSONATA expression](#message-flow-or-global-property-or-jsonata-expression)
* [input parse formats](#input-parse-formats)
* [output timestamp formats](#output-timestamp-formats)
* [output timespan formats](#output-timespan-formats)
* [Conditions](#conditions)
* [TODO](#todo)
* [Bugs and Feedback](#bugs-and-feedback)
* [LICENSE](#license)
* [Other](#other)

@@ -291,4 +294,4 @@ ## Installation

* **Property** _optional_ here can be defined a context property which must be of type boolean. If this property is true alternate time will be used.
* **Alternate time** _optional_ defines an alternate start time which will be used if the property is true. This can be used for different times for example of holidays/weekend.
* **Property** _optional_ here can be defined a [condition](#conditions) under which a alternate time should be used.
* **Alternate time** _optional_ defines an alternate start time which will be used if the condition applies. This can be used for different times for example of holidays/weekend.

@@ -350,9 +353,11 @@ * **Additional Inject on Start** If this checkbox is set the inject node can emit the message on Node-Red Start or on any deploy of this node. There can be defined a delay after the emit should be done. This can be useful for initializing any flow.

* **End Offset** allows to define a positive or negative offset in *seconds*, *minutes* or *hours* to the given **End Time**. This will be useful for sun based times.
* **Property** _optional_ here can be defined a boolean property. If it is true alternate start or and times will be used.
* **Alternate start time** _optional_ defines an alternate start time of the time range which will be used if the property is true. This can be used for different times for example of holidays.
* **Alternate start time** _optional_ defines an alternate start time of the time range which will be used if the [conditions](#conditions) matches. This can be used for different times for example of holidays.
* **Start time** alternate start time
* **Start Offset** offset for the alternate start time
* **Alternate end time** _optional_ defines an alternate end time of the time range which will be used if the property is true. This can be used for different times for example of holidays.
* **Alternate end time** _optional_ defines an alternate end time of the time range which will be used if the [conditions](#conditions) matches. This can be used for different times for example of holidays.
* **End time** alternate end time
* **End Offset** offset for the alternate end time
* **Status** here can be adjusted which status should be displayed under the node.

@@ -400,3 +405,3 @@ * this has the following possibilities:

* **Offset** allows to define a positive or negative offset to the given time.
* **limitation** here it is possible to additionally define a parameter. if defined this comparison will only be made if this parameter has the value "true".
* **limitation** here it is possible to additionally define a parameter. if defined this comparison will only be made if the [conditions](#conditions) matches.
* **result** allows to write the **Input time** to a parameter in a different format. Without defining any **compare with**, the node allows by only defining input and result parameter a simply time format conversation.

@@ -548,17 +553,17 @@

Field | Full Form | Short Form
-------------|--------------------|-----------------------
Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits)
Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits)
Month | NNN (abbr.) |
Day of Month | dd (2 digits) | d (1 or 2 digits)
Day of Week | EE (name) | E (abbr.)
Hour (1-12) | hh (2 digits) | h (1 or 2 digits)
Hour (0-23) | HH (2 digits) | H (1 or 2 digits)
Hour (0-11) | KK (2 digits) | K (1 or 2 digits)
Hour (1-24) | kk (2 digits) | k (1 or 2 digits)
Minute | mm (2 digits) | m (1 or 2 digits)
Second | ss (2 digits) | s (1 or 2 digits)
Millisecond | ll (3 digits) | l (1, 2 or 3 digits)
AM/PM | tt (2 digits) | t (1 or 2 digits)
| Field | Full Form | Short Form |
| ------------ | ------------------- | -------------------------------- |
| Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) |
| Month | MMM (name or abbr.) | MM (2 digits), M (1 or 2 digits) |
| Month | NNN (abbr.) |
| Day of Month | dd (2 digits) | d (1 or 2 digits) |
| Day of Week | EE (name) | E (abbr.) |
| Hour (1-12) | hh (2 digits) | h (1 or 2 digits) |
| Hour (0-23) | HH (2 digits) | H (1 or 2 digits) |
| Hour (0-11) | KK (2 digits) | K (1 or 2 digits) |
| Hour (1-24) | kk (2 digits) | k (1 or 2 digits) |
| Minute | mm (2 digits) | m (1 or 2 digits) |
| Second | ss (2 digits) | s (1 or 2 digits) |
| Millisecond | ll (3 digits) | l (1, 2 or 3 digits) |
| AM/PM | tt (2 digits) | t (1 or 2 digits) |

@@ -600,44 +605,44 @@ ### output timestamp formats

|placeholder|Description|
|--- |--- |
|d|Day of the month as digits; no leading zero for single-digit days.|
|dd|Day of the month as digits; leading zero for single-digit days.|
|ddd|Day of the week as a three-letter abbreviation. (same as E)|
|dddd|Day of the week as its full name. (same as EE)|
|E|Day of the week as a three-letter abbreviation.|
|EE|Day of the week as its full name.|
|M|Month as digits; no leading zero for single-digit months.|
|MM|Month as digits; leading zero for single-digit months.|
|MMM|Month as a three-letter abbreviation.|
|MMMM|Month as its full name.|
|yy|Year as last two digits; leading zero for years less than 10.|
|yyyy|Year represented by four digits.|
|h|Hours; no leading zero for single-digit hours (12-hour clock 1-12).|
|hh|Hours; leading zero for single-digit hours (12-hour clock 01-12).|
|H|Hours; no leading zero for single-digit hours (24-hour clock 0-23).|
|HH|Hours; leading zero for single-digit hours (24-hour clock 00-23).|
|k|Hours; no leading zero for single-digit hours (12-hour clock 0-11).|
|kk|Hours; leading zero for single-digit hours (12-hour clock 00-11).|
|K|Hours; no leading zero for single-digit hours (24-hour clock 1-24).|
|KK|Hours; leading zero for single-digit hours (24-hour clock 01-24).|
|m|Minutes; no leading zero for single-digit minutes.|
|mm|Minutes; leading zero for single-digit minutes.|
|s|Seconds; no leading zero for single-digit seconds.|
|ss|Seconds; leading zero for single-digit seconds.|
|l|Milliseconds; no leading zeros for single-digit|
|ll|Milliseconds; 1 leading zero for single-digit; no for 3 digits|
|lll|Milliseconds; 2 leading zero for single-digit; 2 for 2 digits|
|L|Milliseconds divided by 100 round to 0; no leading zero|
|LL|Milliseconds divided by 10 round to 0; leading zero for single-digit|
|t|Lowercase, single-character time marker string: a or p.|
|tt|Lowercase, two-character time marker string: am or pm.|
|T|Uppercase, single-character time marker string: A or P.|
|TT|Uppercase, two-character time marker string: AM or PM.|
|Z|US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the GMT/UTC offset is returned, e.g. GMT-0500|
|o|GMT/UTC timezone offset, e.g. -0500 or +0230.|
|S|The date's ordinal suffix (st, nd, rd, or th). Works well with d.|
|x|difference of days from timestamp day to output day|
|xx|difference of days from timestamp day to output day with relative names for today, tomorrow, ...|
|'…' or "…"|Literal character sequence. Surrounding quotes are removed.|
|UTC:|Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed.|
| placeholder | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| d | Day of the month as digits; no leading zero for single-digit days. |
| dd | Day of the month as digits; leading zero for single-digit days. |
| ddd | Day of the week as a three-letter abbreviation. (same as E) |
| dddd | Day of the week as its full name. (same as EE) |
| E | Day of the week as a three-letter abbreviation. |
| EE | Day of the week as its full name. |
| M | Month as digits; no leading zero for single-digit months. |
| MM | Month as digits; leading zero for single-digit months. |
| MMM | Month as a three-letter abbreviation. |
| MMMM | Month as its full name. |
| yy | Year as last two digits; leading zero for years less than 10. |
| yyyy | Year represented by four digits. |
| h | Hours; no leading zero for single-digit hours (12-hour clock 1-12). |
| hh | Hours; leading zero for single-digit hours (12-hour clock 01-12). |
| H | Hours; no leading zero for single-digit hours (24-hour clock 0-23). |
| HH | Hours; leading zero for single-digit hours (24-hour clock 00-23). |
| k | Hours; no leading zero for single-digit hours (12-hour clock 0-11). |
| kk | Hours; leading zero for single-digit hours (12-hour clock 00-11). |
| K | Hours; no leading zero for single-digit hours (24-hour clock 1-24). |
| KK | Hours; leading zero for single-digit hours (24-hour clock 01-24). |
| m | Minutes; no leading zero for single-digit minutes. |
| mm | Minutes; leading zero for single-digit minutes. |
| s | Seconds; no leading zero for single-digit seconds. |
| ss | Seconds; leading zero for single-digit seconds. |
| l | Milliseconds; no leading zeros for single-digit |
| ll | Milliseconds; 1 leading zero for single-digit; no for 3 digits |
| lll | Milliseconds; 2 leading zero for single-digit; 2 for 2 digits |
| L | Milliseconds divided by 100 round to 0; no leading zero |
| LL | Milliseconds divided by 10 round to 0; leading zero for single-digit |
| t | Lowercase, single-character time marker string: a or p. |
| tt | Lowercase, two-character time marker string: am or pm. |
| T | Uppercase, single-character time marker string: A or P. |
| TT | Uppercase, two-character time marker string: AM or PM. |
| Z | US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the GMT/UTC offset is returned, e.g. GMT-0500 |
| o | GMT/UTC timezone offset, e.g. -0500 or +0230. |
| S | The date's ordinal suffix (st, nd, rd, or th). Works well with d. |
| x | difference of days from timestamp day to output day |
| xx | difference of days from timestamp day to output day with relative names for today, tomorrow, ... |
| '…' or "…" | Literal character sequence. Surrounding quotes are removed. |
| UTC: | Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed. |

@@ -663,2 +668,32 @@ ### output timespan formats

### Conditions
A condition usually consists of a *property*, an *operator* and depending on the operator, a *threshold*.
*property*, an *operator*:
![condition-1](https://user-images.githubusercontent.com/12692680/57455030-81207a80-726a-11e9-8803-eb7e526950b4.png)
*property*, *operator* and *threshold*:
![condition-2](https://user-images.githubusercontent.com/12692680/57455031-81b91100-726a-11e9-9987-d53c201f79b0.png)
The operators are:
* `is true` - the value of the *property* must be of type boolean and the condition is fulfilled if the value is `true`
* `is false` - the value of the *property* must be of type boolean and the condition is fulfilled if the value is `false`
* `is null` - the value of the *property* must be `undefined` or `null`
* `is not null` - the value of the *property* can have an obscure value that is not `undefined` or `null`
* `is empty` - the condition is fulfilled if the *property* is an empty `string`, `array`, `buffer` or an object with no properties
* `is not empty` - the condition is fulfilled if the *property* is an `string`, `array`, `buffer` which is not empty or an object which has properties
* `true expression` - the condition is fulfilled if the *property* is a number and greater `0` or a Boolean which is `true` or a string containing one of the following values `true`, `yes`, `on`, `ja`. If the property has a string `switchon` then this would evaluate to true, because `on` is part of the string.
* `false expression` - the condition is fulfilled if the *property* is a number and less than or equal `0` or a Boolean which is `false` or a string containing one of the following values `false`, `no`, `off`, `nein`. If the property has a string `nonsens` then this would evaluate to true, because `no` is part of the string.
* `not true expression` - the condition is fulfilled if the *property* is a number and **not** greater `0` or a Boolean which is **not** `true` or a string containing **none** of the following values `true`, `yes`, `on`, `ja`. It the property is a number and **NaN** then this would evaluate to true.
* `false expression` - the condition is fulfilled if the *property* is a number and **not** less than or equal `0` or a Boolean which is **not** `false` or a string containing **none** of the following values `false`, `no`, `off`, `nein`.
* `<`, `<=`, `==`, `!=`, `>`, `>=` - compares the value of the *property* with a *threshold*. Typically this makes only sense if the *property* and the *threshold* are numbers.
* `contain` - the condition is fulfilled if the *property* contains the string defined in the *threshold*.
* `containSome` - the *threshold* must be a string separated with comma `,`, semicolon `;` or pipe `|`. The condition is fulfilled as soon as only one of the seperated parts of the *threshold* string is is included in the *property* value.
* `containEvery` - the *threshold* must be a string separated with comma `,`, semicolon `;` or pipe `|`. The condition is fulfilled as soon as all of the seperated parts of the *threshold* string are included in the *property* value.
A JSONata expression in the *property* must be always a boolean with value true, in this case the operator can not be chosen.
## TODO

@@ -675,3 +710,3 @@

### :moneybag: Donations [![Donate](https://img.shields.io/badge/donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4PCF5YW5ASHBN)
:moneybag: Donations [![Donate](https://img.shields.io/badge/donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4PCF5YW5ASHBN)

@@ -678,0 +713,0 @@ Even for those that don't have the technical knowhow to help developing on there are ways to support development. So if you want to donate some money please feel free to send money via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4PCF5YW5ASHBN).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc