elmicha,
Could you help with this? If I run this:
sh -c 'udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) | fgrep "ATTRS{serial}"'
in terminal on my RPi I receive a reply of:
ATTRS{serial}=="20980000.usb"
I have tried running ithe same in an exec node and don't seem to receive a reply. There seems to be very few examples of using the exec node so before I waste many hours, what am i doing wrong?
[{"id":"dfcd9715.21dc88","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"431dcb9f.0c7444","type":"serial in","z":"dfcd9715.21dc88","name":"","serial":"945372cb.77e01","x":90,"y":240,"wires":[["9916d496.387ae8","28e38cad.dbc024","ab227b07.7fc008"]]},{"id":"64e4d956.1d8d58","type":"debug","z":"dfcd9715.21dc88","name":"GPS","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":710,"y":320,"wires":[]},{"id":"c45f28d5.229658","type":"debug","z":"dfcd9715.21dc88","name":"BMV","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":710,"y":160,"wires":[]},{"id":"5af0f86f.455308","type":"switch","z":"dfcd9715.21dc88","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"bmv","vt":"str"},{"t":"cont","v":"mppt","vt":"str"},{"t":"cont","v":"gps","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":240,"wires":[["c45f28d5.229658"],[],["de9ebd1c.f7cd5","c05b93cc.4d558"]]},{"id":"9916d496.387ae8","type":"function","z":"dfcd9715.21dc88","name":"","func":"var id = context.get('id') || 0;\n\nif(msg.payload.includes('GPRMC')){\n id = 'gps'\n context.set('id', id);\n} else if(msg.payload.includes('BMV')){\n id = 'bmv';\n} else if(msg.payload.includes('MPPT')){\n id = 'mppt';\n} else {\n //do nothing\n}\n\nmsg.topic = id;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":240,"wires":[["5af0f86f.455308"]]},{"id":"28e38cad.dbc024","type":"debug","z":"dfcd9715.21dc88","name":"USB direct","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":240,"y":140,"wires":[]},{"id":"c05b93cc.4d558","type":"debug","z":"dfcd9715.21dc88","name":"MPPT","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":710,"y":240,"wires":[]},{"id":"de9ebd1c.f7cd5","type":"function","z":"dfcd9715.21dc88","name":"","func":"var Payload = msg.payload.includes('GPRMC');\n if(Payload){\n var output = msg.payload.split(\",\")\n var valid = String(output[2]);\n if(valid === 'A'){\n var lat = parseFloat((output[3]/100).toFixed(5));\n var north = String(output[4]);\n var lon = parseFloat((output[5]/100).toFixed(5));\n var west =String(output[6]);\n \n if(west === 'W'){\n lon = lon * -1;\n }\n if(north === 'S'){\n north = north * -1;\n }\n msg.payload = {lat,lon};\n return msg\n } else if(valid === 'V'){\n //invalid data\n }\n }\n","outputs":1,"noerr":0,"x":510,"y":360,"wires":[["64e4d956.1d8d58"]]},{"id":"ab227b07.7fc008","type":"exec","z":"dfcd9715.21dc88","command":"sh -c 'udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) | fgrep \"ATTRS{serial}\"'","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"","x":420,"y":420,"wires":[["2edf564a.d0627a"],["a31e75da.76f798"],["9112f869.2daa48"]]},{"id":"2edf564a.d0627a","type":"debug","z":"dfcd9715.21dc88","name":"ONE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":400,"wires":[]},{"id":"a31e75da.76f798","type":"debug","z":"dfcd9715.21dc88","name":"TWO","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":460,"wires":[]},{"id":"9112f869.2daa48","type":"debug","z":"dfcd9715.21dc88","name":"THREE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":830,"y":520,"wires":[]},{"id":"945372cb.77e01","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"}]