node-red-contrib-eskomsepush 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-eskomsepush",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Node-RED interface for the Eskomsepush API",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -238,7 +238,8 @@ module.exports = function (RED) {
238
238
  console.warn('Not an array:', dates.stages[stageIndex]) // Warning if not an array
239
239
  }
240
240
  } else {
241
- console.warn('Invalid stage index:', stageIndex) // Warning if stage index is out of bounds
241
+ console.warn(`Invalid stage index: ${stageIndex}. No loadshedding going on?`) // Warning if stage index is out of bounds
242
+ BreakLoop = true
242
243
  }
243
244
  if (BreakLoop) { break }
244
245
  }
@@ -290,11 +291,13 @@ module.exports = function (RED) {
290
291
  statusText += ' - ' + new Date(EskomSePushInfo.calc.end).toLocaleTimeString([], { timeStyle: 'short' })
291
292
  }
292
293
  } else {
293
- if (new Date(EskomSePushInfo.calc.next.start).getUTCDay() !== now.getUTCDate) {
294
- statusText += new Date(EskomSePushInfo.calc.next.start).toLocaleString([], { weekday: 'short' }) + ' '
294
+ if (EskomSePushInfo.calc.next) {
295
+ if (new Date(EskomSePushInfo.calc.next.start).getUTCDay() !== now.getUTCDate()) {
296
+ statusText += new Date(EskomSePushInfo.calc.next.start).toLocaleString([], { weekday: 'short' }) + ' '
297
+ }
298
+ statusText += new Date(EskomSePushInfo.calc.next.start).toLocaleTimeString([], { timeStyle: 'short' })
299
+ statusText += ' - ' + new Date(EskomSePushInfo.calc.next.end).toLocaleTimeString([], { timeStyle: 'short' })
295
300
  }
296
- statusText += new Date(EskomSePushInfo.calc.next.start).toLocaleTimeString([], { timeStyle: 'short' })
297
- statusText += ' - ' + new Date(EskomSePushInfo.calc.next.end).toLocaleTimeString([], { timeStyle: 'short' })
298
301
  }
299
302
 
300
303
  statusText += ' (API: ' + EskomSePushInfo.api.info.allowance.count + '/' + EskomSePushInfo.api.info.allowance.limit + ')'