Hi Everyone,
I have been playing around with Node-Red on and off for while but only pretty basic stuff. I am now working on a project that I want to use to expand my skills in this area. This involves using it to communicate with a radio device over RS232 using basic text commands. I have been successful in creating a basic flow to send a command to it and get a response. Now I want to take that text response and turn it into an object. When I send a "stat" command I receive back the following:-
[local]
noise=0
power=0
rssi=0
temp=104
batt=130
I would like to format this as an object like this:-
{"noise":0,"power":0,"rssi":0,temp:104,"batt":130}
I am not sure if there are existing nodes that would be appropriate for this or if i will need to use a function node and write in JS, which I have no experience in.
Some help on getting started with this would be great.
[{"id":"2b4be924.866df6","type":"serial in","z":"1c4f9602.c5248a","name":"com 7 out","serial":"ffbf433b.acf54","x":551.7812347412109,"y":655.900520324707,"wires":[["e18f50a.323d9b"]]},{"id":"8010f34b.2cc26","type":"serial out","z":"1c4f9602.c5248a","name":"com7 in","serial":"ffbf433b.acf54","x":463.78690338134766,"y":752.1619396209717,"wires":[]},{"id":"ca3ef3d2.ffa8f","type":"function","z":"1c4f9602.c5248a","name":"","func":"msg.payload = \"stat\\r\";\nreturn msg;","outputs":1,"noerr":0,"x":297.0142402648926,"y":803.0056781768799,"wires":[["8010f34b.2cc26"]]},{"id":"e18f50a.323d9b","type":"debug","z":"1c4f9602.c5248a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":955.7925262451172,"y":850.4232006072998,"wires":[]},{"id":"b10d5b7.decd8a8","type":"inject","z":"1c4f9602.c5248a","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":129.79261779785156,"y":674.2386245727539,"wires":[["ca3ef3d2.ffa8f"]]},{"id":"ffbf433b.acf54","type":"serial-port","z":"","serialport":"com7","serialbaud":"38400","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"100","bin":"false","out":"interbyte","addchar":"","responsetimeout":"10000"}]