Getting value out of message

I try to get the value for nextEvent from eztimer where I used sunsetStart as triggermoment.
I get back:

1-7-2023 11:54:44node: debug 7
info : msg.payload : Object
name: "eztimer"
state: undefined
trigger: object
property: "msg.payload"
value: 1
nextEvent: "2023-07-01T19:55:57.515Z"

but when I do in a functionnode

var when = msg.payload.nextEvent;

I get an "undefined" back.
I think I do not understand how to get this value from te message.

You could try the following and see if that works for you.
let when = msg.payload['nextEvent'];

Like @E1cid said, I suspect the structure for the complete object is a bit different to what you posted.
let when = msg.payload.trigger['nextEvent'];

If you use the copy path button described here you will get the correct path to use.
I suspect it is msg.payload.trigger.nextEvent, but your posted info is not great, you can use the copy value button to get a correctly formatted json to post in future.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.