Hi,
I'm working on a small status monitoring solution for LoRaWAN gateways using metadata of device messages coming in via MQTT.
I'm using https://groups.google.com/g/node-red/c/bahx8U3oBdI?pli=1 as a basis which works fine for me when I use part of the msg.topic string and put it into a variable like Lennart Hennig:
var parts = msg.topic.split ("/");
generating a payload like
be010004: "online"
where be010004 is the split part of the topic.
But what I need is part of the msg.payload like:
gweui: "FCAAAAAAAAAAAAAA"
status: "online"
being modified to a new payload
FCAAAAAAAAAAAAAA: "online"
When I try to enter the gweui into a variable like
var parts = msg.payload.gweui ;
it fails ... as you already might have guessed I'm not really fit in JS and I think I got (again) somewhat lost in JSON object <-> string stuff, but all my attempts to use a JSON converter in Node-RED failed to insufficient know how ...
Any hint welcome !
Matthias