Socket
Socket
Sign inDemoInstall

node-red-contrib-sun-position

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-sun-position - npm Package Compare versions

Comparing version 1.0.0-alpha-3 to 1.0.0-alpha-4

29

nodes/clock-timer.js

@@ -77,16 +77,2 @@ /********************************************

/**
* clip a test to a maximum length
* @param {string} v text to clip
* @param {number} l length to clip the text
*/
function clipValueLength(v, l) {
l = l || 15;
v = String(v);
if (v.length > l) {
return v.slice(0, (l - 3)) + '...';
}
return v;
}
/******************************************************************************************/

@@ -390,2 +376,3 @@ /**

rule.timeData.ts = rule.timeData.value.getTime();
rule.timeData.dayId = hlp.getDayId(rule.timeData.value);
if (rule.timeMinType !== 'none') {

@@ -413,2 +400,3 @@ rule.timeDataMin = node.positionConfig.getTimeProp(node, msg, {

rule.timeData.ts = numMin;
rule.timeData.dayId = hlp.getDayId(rule.timeDataMin.value);
}

@@ -439,2 +427,3 @@ }

rule.timeData.ts = numMax;
rule.timeData.dayId = hlp.getDayId(rule.timeDataMax.value);
}

@@ -457,2 +446,4 @@ }

const nowNr = now.getTime();
const dayNr = now.getDay();
const dayId = hlp.getDayId(now);
prepareRules(node, msg, tempData);

@@ -477,3 +468,3 @@ node.debug(`checkRules nowNr=${nowNr}, rules.count=${node.rules.count}, rules.lastUntil=${node.rules.lastUntil}`); // {colors:true, compact:10}

}
if (rule.timeDays && rule.timeDays !== '*' && !rule.timeDays.includes(now.getDay())) {
if (rule.timeDays && rule.timeDays !== '*' && !rule.timeDays.includes(dayNr)) {
return null;

@@ -483,3 +474,3 @@ }

// node.debug(`pos=${rule.pos} type=${rule.timeOpText} - ${rule.timeValue} - rule.timeData = ${ util.inspect(rule.timeData, { colors: true, compact: 40, breakLength: Infinity }) }`);
if (num >=0 && cmp(num)) {
if (dayId === rule.timeData.dayId && num >=0 && cmp(num)) {
return rule;

@@ -594,2 +585,3 @@ }

node.reason.description = RED._('clock-timer.reasons.'+name, data);
node.debug(`checkRules data=${util.inspect(data, { colors: true, compact: 10, breakLength: Infinity })}`);
node.debug(`checkRules end pos=${node.payload.current} reason=${node.reason.code} description=${node.reason.description} all=${util.inspect(livingRuleData, { colors: true, compact: 10, breakLength: Infinity })}`);

@@ -679,3 +671,6 @@ return livingRuleData;

node.reason.stateComplete = (!timeCtrl.payload) ? node.reason.state : clipValueLength(timeCtrl.payload.toString(),15) + ' - ' + node.reason.state;
node.reason.stateComplete = node.reason.state ;
if (timeCtrl.payload && typeof timeCtrl.payload !== 'object') {
node.reason.stateComplete = hlp.clipStrLength(timeCtrl.payload.toString(),10) + ' - ' + node.reason.stateComplete;
}
node.status({

@@ -682,0 +677,0 @@ fill,

@@ -30,2 +30,3 @@ {

"ruleTimeMin": "at the earliest (min)",
"ruleTimeDays":"only on day",
"ruleDescription": "Description",

@@ -102,2 +103,3 @@ "ruleBlindLevel": "blind position",

"level": "level",
"ruleTimeDays": "select days wherefore it should be valid",
"autoTrigger":"automatic triggers new calculation of the blind position in a dynamic changing time interval"

@@ -104,0 +106,0 @@ },

@@ -128,3 +128,3 @@ /********************************************

const today = new Date();
const dayId = this._getDayId(today); // this._getUTCDayId(today);
const dayId = hlp.getDayId(today); // this._getUTCDayId(today);
const tomorrow = today.addDays(1);

@@ -191,3 +191,3 @@ this._sunTimesRefresh(today, tomorrow, dayId);

let result;
const dayid = this._getDayId(now); // this._getUTCDayId(now);
const dayid = hlp.getDayId(now); // this._getUTCDayId(now);
const today = this._sunTimesCheck(); // refresh if needed, get dayId

@@ -245,3 +245,3 @@ // this.debug(`getSunTimeByName value=${value} offset=${offset} multiplier=${multiplier} next=${next} days=${days} now=${now} dayid=${dayid} today=${util.inspect(today, { colors: true, compact: 10, breakLength: Infinity })}`);

getSunTimePrevNext(now) {
let dayid = this._getDayId(now); // this._getUTCDayId(now);
let dayid = hlp.getDayId(now); // this._getUTCDayId(now);
const today = this._sunTimesCheck(); // refresh if needed, get dayId

@@ -365,3 +365,3 @@ let result;

const datebase = new Date(now);
const dayid = this._getDayId(now); // this._getUTCDayId(now);
const dayid = hlp.getDayId(now); // this._getUTCDayId(now);
const today = this._moonTimesCheck(); // refresh if needed, get dayId

@@ -555,4 +555,3 @@ // this.debug(`getMoonTimeByName value=${value} offset=${offset} multiplier=${multiplier} next=${next} days=${days} now=${now} dayid=${dayid} today=${today}`);

} else if (data.type === 'dayOfMonth') {
result = new Date();
result = hlp.getSpecialDayOfMonth(result.getFullYear(),result.getMonth(), data.value);
result = hlp.getSpecialDayOfMonth(now.getFullYear(),now.getMonth(), data.value);
if (result !== null && typeof result !== 'undefined') {

@@ -901,3 +900,3 @@ const offsetX = this.getFloatProp(_srcNode, msg, data.offsetType, data.offset, 0, data.offsetCallback, data.noOffsetError);

const dayid = this._getDayId(date); // this._getUTCDayId(now);
const dayid = hlp.getDayId(date); // this._getUTCDayId(now);
const today = this._sunTimesCheck(); // refresh if needed, get dayId

@@ -1057,4 +1056,4 @@ // this.debug(`getSunTimes value=${value} offset=${offset} multiplier=${multiplier} next=${next} days=${days} now=${now} dayid=${dayid} today=${util.inspect(today, { colors: true, compact: 10, breakLength: Infinity })}`);

const dayidReq = this._getDayId(date); // this._getUTCDayId(now);
const dayIdNow = this._getDayId(now); // this._getUTCDayId(dateb);
const dayidReq = hlp.getDayId(date); // this._getUTCDayId(now);
const dayIdNow = hlp.getDayId(now); // this._getUTCDayId(dateb);

@@ -1106,3 +1105,3 @@ if (dayidReq === dayIdNow) {

const today = new Date();
const dayId = this._getDayId(today); // _getUTCDayId(today);
const dayId = hlp.getDayId(today); // _getUTCDayId(today);
// this.debug(`_sunTimesCheck ${this.sunDayId} - ${dayId}`);

@@ -1153,3 +1152,3 @@ if (force || this.sunDayId !== dayId) {

const today = new Date();
const dayId = this._getDayId(today); // this._getUTCDayId(dateb);
const dayId = hlp.getDayId(today); // this._getUTCDayId(dateb);
if (force || this.moonDayId !== dayId) {

@@ -1166,10 +1165,2 @@ this.debug(`_moonTimesCheck - need refresh - force=${ force }, base-dayId=${ this.moonDayId } current-dayId=${ dayId }`);

}
_getUTCDayId(d) {
return d.getUTCDay() + (d.getUTCMonth() * 31) + (d.getUTCFullYear() * 372);
}
_getDayId(d) {
return d.getDay() + (d.getMonth() * 31) + (d.getFullYear() * 372);
}
}

@@ -1176,0 +1167,0 @@

{
"name": "node-red-contrib-sun-position",
"version": "1.0.0-alpha-3",
"version": "1.0.0-alpha-4",
"description": "NodeRED nodes to get sun and moon position",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc