A method to extract data from the event-state node


1 Like

Nice one! :slight_smile:
I’ve just tried it with an eWeLink button & it works with a couple of minor issues:
The button sends different messages for ‘press’ & ‘RSSI’ so I used a switch node to separate these.
I’m a bit rusty with node red so it’s good to have others on the case!
Cheers
Ian

2 Likes

I did that in this way: Noob Node-RED question: how to access a value in JSON tree? - #4 by joennuh

1 Like

I get you.
I found it easier to filter the string rather than the JSON

For completeness:

Some time ago, there was a similar issue involving the mqtt in node. It was resolved by giving the user an option to get the output as an object, rather than a JSON string. Several other options are provided, and I suspect it would not be difficult to do something similar for the event-state node in a way that would be backward compatible .

path-nodered

Each branch in the json object has a path that can be “copy/paste” to the “change” node

Yes, or more exactly, each property of the JavaScript object can be selected in the change node. I also find this easier to deal with than parsing a JSON string. It would be easier still if the event-state node could output an object directly, so that no JSON node would be needed.