diff --git a/suncron.html b/suncron.html index d3e70a6..8a18e5b 100644 --- a/suncron.html +++ b/suncron.html @@ -1216,7 +1216,7 @@

Sun event outputs

obj
msg.next - string + obj

Details

@@ -1261,7 +1261,7 @@
Example msg.schedule object

Next

- The msg.next attribute contains a string hinting at the next upcoming event, e.g. "sunsetStart @ 21:29" + The msg.next attribute contains the event object of the schedule which is coming up next.

Schedule event outputs

diff --git a/suncron.js b/suncron.js index 2e0fec3..9f47209 100644 --- a/suncron.js +++ b/suncron.js @@ -266,19 +266,22 @@ module.exports = function (RED) { } } - let nextEvent + let next try { nextEvent = findNextEvent(schedule) + console.log('schedule', schedule) + console.log('nextEvent', nextEvent) + next = schedule[nextEvent.eventName] } catch (e) { - nextEvent = e.message + next = null } node.send({ topic, payload: castPayload(payload, payloadType), schedule: formatSchedule(schedule), - next: `${nextEvent.eventName} @ ${nextEvent.eventTime.format('HH:mm')}`, + next, }) }