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.15 to 1.0.16

.gitpod.Dockerfile

12

CHANGELOG.md
# node-red-contrib-sun-position
#### 1.0.16: BugFix
- general
- fix #119
- if a positive offset is used the next time was calculated wrong
- blind-control + clock-time
- fix #128 for blind-control + clock-time
- with #127 the also overrides with a priority higher than `0` will be expire. The documentation is changed to reflect this.
- fixed problem that an override can not set as not expiring
- fixed state text and level output if level-value of -1 is used
#### 1.0.15: BugFix + maintenance

@@ -4,0 +16,0 @@

2

clock_timer.md

@@ -96,3 +96,3 @@ # clock-timer Controller

- A higher number is a higher priority. So prio 1 is the lowest priority.
- **expire** (optional) Enables to define an override as automatically expiring. As default value for overrides of priority `0` the value in the settings is be used. Overrides with a priority higher than `0` will not expire by default.
- **expire** (optional) Enables to define an override as automatically expiring. As default value the value in the settings is be used.
- A message property `msg.expire`

@@ -99,0 +99,0 @@ - The value must be a time in milliseconds which is greater than 100. Otherwise the override will be set to not expiring.

@@ -94,3 +94,3 @@ /********************************************

node.log(`Overwrite is set which never expire (${reason})`);
node.debug(`expireNever expire=${dExpire}ms ${ typeof dExpire } - isNaN=${ isNaN(dExpire) } - finite=${ !isFinite(dExpire) } - min=${ dExpire < 100} state=${String(node.timeClockData.overwrite.expires)}`);
node.debug(`expireNever expire=${dExpire}ms ${ typeof dExpire } - isNaN=${ isNaN(dExpire) } - finite=${ !isFinite(dExpire) } - min=${ dExpire < 100}`);
delete node.timeClockData.overwrite.expireTs;

@@ -197,2 +197,3 @@ delete node.timeClockData.overwrite.expireDate;

// if active, the prio must be 0 or given with same or higher as current overwrite otherwise this will not work
node.debug(`do not check any overwrite, priority of message ${nPrio} not matches current overwrite priority ${node.blindData.overwrite.priority}`);
return setOverwriteReason(node);

@@ -215,3 +216,6 @@ }

const nExpire = hlp.getMsgNumberValue(msg, 'expire');
let nExpire = hlp.getMsgNumberValue(msg, 'expire');
if (msg.topic && String(msg.topic).includes('noExpir')) {
nExpire = -1;
}
if (!overrideData && node.timeClockData.overwrite.active) {

@@ -246,3 +250,3 @@ node.debug(`overwrite active, check of prio=${nPrio} or nExpire=${nExpire}`);

node.debug(`no expire defined, using default or will not expire`);
setExpiringOverwrite(node, dNow, NaN, 'no expire defined');
setExpiringOverwrite(node, dNow, NaN, 'no special expire defined');
}

@@ -249,0 +253,0 @@ if (nPrio > 0) {

@@ -87,39 +87,54 @@ /********************************************

this.time = config.time;
this.timeType = config.timeType || 'none';
this.timeDays = config.timeDays;
this.timeOnlyOddDays = config.timeOnlyOddDays;
this.timeOnlyEvenDays = config.timeOnlyEvenDays;
this.timeMonths = config.timeMonths;
this.timeAltDays = config.timeAltDays;
this.timeAltOnlyOddDays = config.timeAltOnlyOddDays;
this.timeAltOnlyEvenDays = config.timeAltOnlyEvenDays;
this.timeAltMonths = config.timeAltMonths;
this.timeData = {
type: config.timeType || 'none',
value : config.time,
offsetType : config.offsetType,
offset : config.offset || config.timeOffset || 0,
multiplier : config.offsetMultiplier || config.timeOffsetMultiplier || 60,
next : true,
days : config.timeDays,
months : config.timeMonths,
onlyOddDays: config.timeOnlyOddDays,
onlyEvenDays: config.timeOnlyEvenDays
};
if (this.timeDays === '') {
if (!this.timeData.offsetType) {
this.timeData.offsetType = ((this.timeData.offset === 0) ? 'none' : 'num');
}
if (this.timeData.days === '') {
throw new Error('No valid days given! Please check settings!');
}
if (this.timeAltDays === '') {
if (this.timeData.months === '') {
throw new Error('No valid month given! Please check settings!');
}
if (this.timeData.onlyEvenDays && this.timeData.onlyOddDays) {
this.timeData.onlyEvenDays = false;
this.timeData.onlyOddDays = false;
}
this.timeAltData = {
type: config.timeAltType || 'none',
value : config.timeAlt || '',
offsetType : config.timeAltOffsetType,
offset : config.timeAltOffset || 0,
multiplier : config.timeAltOffsetMultiplier || 60,
next : true,
days : config.timeAltDays,
months : config.timeAltMonths,
onlyOddDays: config.timeAltOnlyOddDays,
onlyEvenDays: config.timeAltOnlyEvenDays
};
if (!this.timeAltData.offsetType) { this.timeAltData.offsetType = ((this.timeAltData.offset === 0) ? 'none' : 'num'); }
if (this.timeAltData.days === '') {
throw new Error('No valid alternate days given! Please check settings!');
}
if (this.timeMonths === '') {
throw new Error('No valid month given! Please check settings!');
}
if (this.timeAltMonths === '') {
if (this.timeAltData.months === '') {
throw new Error('No valid alternate month given! Please check settings!');
}
if (this.timeOnlyEvenDays && this.timeOnlyOddDays) {
this.timeOnlyEvenDays = false;
this.timeOnlyOddDays = false;
if (this.timeAltData.onlyEvenDays && this.timeAltData.onlyOddDays) {
this.timeAltData.onlyEvenDays = false;
this.timeAltData.onlyOddDays = false;
}
if (this.timeAltOnlyEvenDays && this.timeAltOnlyOddDays) {
this.timeAltOnlyEvenDays = false;
this.timeAltOnlyOddDays = false;
}
this.offset = config.offset || config.timeOffset || 0;
this.offsetType = config.offsetType;
if (!this.offsetType) { this.offsetType = ((this.offset === 0) ? 'none' : 'num'); }
this.offsetMultiplier = config.offsetMultiplier || config.timeOffsetMultiplier || 60;
this.property = config.property || '';

@@ -130,8 +145,2 @@ this.propertyType = config.propertyType || 'none';

this.propertyThresholdType = config.propertyThresholdType;
this.timeAlt = config.timeAlt || '';
this.timeAltType = config.timeAltType || 'none';
this.timeAltOffset = config.timeAltOffset || 0;
this.timeAltOffsetType = config.timeAltOffsetType;
if (!this.timeAltOffsetType) { this.timeAltOffsetType = ((this.timeAltOffset === 0) ? 'none' : 'num'); }
this.timeAltOffsetMultiplier = config.timeAltOffsetMultiplier || 60;

@@ -170,5 +179,7 @@ this.recalcTime = (config.recalcTime || 2) * 3600000;

* @param {boolean} [_onInit] - _true_ if is in initialisation
* @param {Date} [dNow] - Date object with the calculation base
* @returns {object} state or error
*/
function doCreateTimeout(node, _onInit) {
function doCreateTimeout(node, _onInit, dNow) {
node.debug(`doCreateTimeout _onInit=${_onInit}`);
let errorStatus = '';

@@ -178,2 +189,7 @@ let warnStatus = '';

let isFixedTime = true;
let timeValid = (node.timeData && node.timeData.type !== 'none');
let timeAltValid = (node.timeAltData && node.propertyType !== 'none' && node.timeAltData.type !== 'none');
node.timeData.now = dNow || new Date();
node.timeAltData.now = node.timeData.now;
node.nextTime = null;

@@ -209,4 +225,4 @@ node.nextTimeAlt = null;

warnStatus = RED._('time-inject.errors.invalid-daterange') + ' [' + node.positionConfig.toDateString(node.nextTime)+ ']';
node.timeType = 'none';
node.timeAltType = 'none';
timeValid = false;
timeAltValid = false;
}

@@ -218,20 +234,9 @@ } else {

warnStatus = RED._('time-inject.errors.invalid-daterange') + ' [' + node.positionConfig.toDateString(node.nextTime)+ ']';
node.timeType = 'none';
node.timeAltType = 'none';
timeValid = false;
timeAltValid = false;
}
}
}
if (node.timeType !== 'none' && node.positionConfig) {
node.nextTimeData = node.positionConfig.getTimeProp(node, undefined, {
type: node.timeType,
value : node.time,
offsetType : node.offsetType,
offset : node.offset,
multiplier : node.offsetMultiplier,
next : true,
days : node.timeDays,
months : node.timeMonths,
onlyOddDays: node.timeOnlyOddDays,
onlyEvenDays: node.timeOnlyEvenDays
});
if (timeValid && node.positionConfig) {
node.nextTimeData = node.positionConfig.getTimeProp(node, undefined, node.timeData);
if (node.nextTimeData.error) {

@@ -252,17 +257,4 @@ errorStatus = 'could not evaluate time';

if (node.propertyType !== 'none' &&
node.timeAltType !== 'none' &&
node.positionConfig) {
node.nextTimeAltData = node.positionConfig.getTimeProp(node, undefined, {
type: node.timeAltType,
value : node.timeAlt,
offsetType : node.timeAltOffsetType,
offset : node.timeAltOffset,
multiplier : node.timeAltOffsetMultiplier,
next : true,
days : node.timeAltDays,
months : node.timeAltMonths,
onlyOddDays: node.timeAltOnlyOddDays,
onlyEvenDays: node.timeAltOnlyEvenDays
});
if (timeAltValid && node.positionConfig) {
node.nextTimeAltData = node.positionConfig.getTimeProp(node, undefined, node.timeAltData);

@@ -424,7 +416,8 @@ if (node.nextTimeAltData.error) {

send = send || function (...args) { node.send.apply(node, args); };
const dNow = new Date();
try {
msg._srcid = node.id;
node.debug('--------- time-inject - input');
doCreateTimeout(node);
node.debug('--------- time-inject - input (type=' + msg.type + ')');
doCreateTimeout(node, false, dNow);
msg.topic = config.topic;

@@ -441,3 +434,4 @@ if (!node.positionConfig) {

multiplier: config.payloadOffsetMultiplier,
next: true
next: true,
now: dNow
});

@@ -464,3 +458,4 @@ if (value === null || (typeof value === 'undefined')) {

next: config.addPayload1Next,
days: config.addPayload1Days
days: config.addPayload1Days,
now: dNow
});

@@ -477,3 +472,4 @@ tsSetAddProp(this, msg, {

next: config.addPayload2Next,
days: config.addPayload2Days
days: config.addPayload2Days,
now: dNow
});

@@ -490,3 +486,4 @@ tsSetAddProp(this, msg, {

next: config.addPayload3Next,
days: config.addPayload3Days
days: config.addPayload3Days,
now: dNow
});

@@ -524,3 +521,3 @@ }

node.emit('input', {
type: 'once'
type: 'once/startup'
});

@@ -527,0 +524,0 @@ doCreateTimeout(node);

{
"name": "node-red-contrib-sun-position",
"version": "1.0.15",
"version": "1.0.16",
"description": "NodeRED nodes to get sun and moon position",

@@ -98,5 +98,6 @@ "keywords": [

"eslint-plugin-html": "^6.0.0",
"eslint-plugin-jsdoc": "^21.0.0",
"eslint-plugin-json": "^2.1.0",
"eslint-plugin-node": "^11.0.0"
"eslint-plugin-jsdoc": "^22.1.0",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-node": "^11.0.0",
"minimist": ">=1.2.5"
},

@@ -103,0 +104,0 @@ "disabledSettings": {

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

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 not supported yet

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

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 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