Sparkplug_b - Real life example in Node-Red

Hey,

I am using the Signal-Fire Ranger to get telemetry out of the field. They have their own cloud service but allow you to send the data to another/your own MQTT server if you want.

This is based off of Terry’s decode Sparkplug post

Hopefully someone will be able to use this and build their own awesome apps with it. I am currently waiting for documentation on the tag structure for sending commands. The next version will be able to trigger a DO (Digital Output)

[{"id":"f10784d0.015068","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"8a415d7a.2a74c","type":"decode","z":"f10784d0.015068","name":"sparkplug_b","protofile":"2693e25a.9357de","protoType":"Payload","x":330,"y":100,"wires":[["11fd00c3.5b313f","183b7dfb.f32a42"]]},{"id":"fd45ee80.d16a8","type":"mqtt in","z":"f10784d0.015068","name":"groovEPIC_dev","topic":"#","qos":"2","datatype":"auto","broker":"1008ff7a.33cd81","x":140,"y":100,"wires":[["8a415d7a.2a74c"]]},{"id":"11fd00c3.5b313f","type":"change","z":"f10784d0.015068","name":"","rules":[{"t":"move","p":"payload.metrics","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":100,"wires":[["33269ef8.0ee502"]]},{"id":"33269ef8.0ee502","type":"split","z":"f10784d0.015068","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":390,"y":360,"wires":[["9b32db74.377568"]]},{"id":"9b32db74.377568","type":"switch","z":"f10784d0.015068","name":"","property":"payload.alias","propertyType":"msg","rules":[{"t":"cont","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"7","vt":"num"},{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"11","vt":"num"},{"t":"eq","v":"12","vt":"num"},{"t":"eq","v":"13","vt":"num"},{"t":"eq","v":"31","vt":"num"},{"t":"eq","v":"44","vt":"num"},{"t":"eq","v":"57","vt":"num"},{"t":"eq","v":"58","vt":"num"},{"t":"eq","v":"59","vt":"num"}],"checkall":"true","repair":false,"outputs":12,"x":610,"y":360,"wires":[["65d16ebb.6087d"],["3abf0010.523c"],["974f946d.242268"],["18e3836b.0da06d"],["b4004d2d.05be7"],["763b09b6.3ae848"],["fd3d54ee.af9868"],["ad585bae.75c758"],["c53eab55.1ea6e8"],["bf774233.28f1e"],["d0382c24.35db4"],["7695ca3e.6f87e4"]],"outputLabels":["Node Control/Group ID","Properties/HW Rev","Properties/SW Rev","Properties/Name","Temperature","Battery","ConnectTime","Dev1/DIN1","Dev1/DIN2","Dev1/DOUT1","Dev1/AIN1","Dev1/AIN1 Raw"]},{"id":"1784a97b.701097","type":"debug","z":"f10784d0.015068","name":"fv","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1070,"y":360,"wires":[]},{"id":"65d16ebb.6087d","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"4","tableStartIndex":"","value":"payload.metrics[4].stringValue","valueType":"msg","name":"","x":810,"y":160,"wires":[["1784a97b.701097"]]},{"id":"974f946d.242268","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"7","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":240,"wires":[["1784a97b.701097"]]},{"id":"3abf0010.523c","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"5","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":200,"wires":[["1784a97b.701097"]]},{"id":"18e3836b.0da06d","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"8","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":280,"wires":[["1784a97b.701097"]]},{"id":"b4004d2d.05be7","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"11","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":320,"wires":[["1784a97b.701097"]]},{"id":"763b09b6.3ae848","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"12","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":360,"wires":[["1784a97b.701097"]]},{"id":"d0382c24.35db4","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"58","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":560,"wires":[["1784a97b.701097"]]},{"id":"bf774233.28f1e","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"57","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":520,"wires":[["1784a97b.701097"]]},{"id":"c53eab55.1ea6e8","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"44","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":480,"wires":[["1784a97b.701097"]]},{"id":"ad585bae.75c758","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"31","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":440,"wires":[["1784a97b.701097"]]},{"id":"7695ca3e.6f87e4","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"59","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":600,"wires":[["1784a97b.701097"]]},{"id":"183b7dfb.f32a42","type":"debug","z":"f10784d0.015068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":200,"wires":[]},{"id":"fd3d54ee.af9868","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"13","tableStartIndex":"","value":"payload.longValue","valueType":"msg","name":"","x":810,"y":400,"wires":[["1784a97b.701097"]]},{"id":"2693e25a.9357de","type":"protobuf-file","z":"","protopath":"/home/dev/unsecured/sparkplug_b.proto"},{"id":"1008ff7a.33cd81","type":"mqtt-broker","z":"","name":"Chariot","broker":"postman.cloudmqtt.com","port":"13650","tls":"","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f216f435.690668","type":"groov-data-store","z":"","project":"f7cad6e5.05f6f8","dsName":"sfr"},{"id":"f7cad6e5.05f6f8","type":"groov-project","z":"","address":"localhost"}]

If you want to see it in action, I have a readonly page up on my dev Groov Epic.
https://nrtest1.netdna.io
u: sf
p: sf

HMI


Node-Red

I am still loving the Groov Epic and all the help and goodies that Opto22 provides.

Best Regards,
Dan

6 Likes

Hi, I am doing the same thing with the Signal-Fire Ranger, but my flow is slightly different and I’m not getting all the NBIRTH messages. Can you please post your flow code? I would appreciate the help. Like you, I’m in love with this Ranger, MQTT, and LTE-CAT-M1 now.

[{“id”:“fb7e78fa.9d0928”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:""},{“id”:“252236cc.77754a”,“type”:“aedes broker”,“z”:“fb7e78fa.9d0928”,“name”:“Aedes MQTT Broker”,“mqtt_port”:“8883”,“mqtt_ws_port”:"",“cert”:"",“key”:"",“certname”:"",“keyname”:"",“dburl”:"",“usetls”:false,“x”:110,“y”:80,“wires”:[[“65fd1599.b8034c”]]},{“id”:“65fd1599.b8034c”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:590,“y”:80,“wires”:[]},{“id”:“18de20e5.6de6cf”,“type”:“mqtt in”,“z”:“fb7e78fa.9d0928”,“name”:“MQTT Subscriber - spBv1.0/none/NDATA/352656100597536”,“topic”:“spBv1.0/none/NDATA/352656100597536”,“qos”:“1”,“datatype”:“auto”,“broker”:“e8c24602.c62148”,“x”:240,“y”:220,“wires”:[[“bd28096.1df33f8”,“be5a9f90.aadb”]]},{“id”:“bd28096.1df33f8”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:590,“y”:180,“wires”:[]},{“id”:“be5a9f90.aadb”,“type”:“decode”,“z”:“fb7e78fa.9d0928”,“name”:“GoogleProtoDecoder”,“protofile”:“1a7592b8.97df6d”,“protoType”:“Payload”,“x”:300,“y”:300,“wires”:[[“f8b3d90d.170978”,“43f246.e6370dbc”]]},{“id”:“d64c525e.00bcb”,“type”:“groov-write-ds”,“z”:“fb7e78fa.9d0928”,“dataStore”:“6109592a.3f4ea8”,“tagName”:“RANGER01-AIN1”,“tableStartIndex”:"",“value”:“payload.floatValue”,“valueType”:“msg”,“name”:"",“x”:1010,“y”:440,“wires”:[[]]},{“id”:“967f034e.d9fe4”,“type”:“switch”,“z”:“fb7e78fa.9d0928”,“name”:“Switch”,“property”:“payload.alias”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“59”,“vt”:“str”},{“t”:“eq”,“v”:“12”,“vt”:“str”},{“t”:“eq”,“v”:“11”,“vt”:“str”},{“t”:“eq”,“v”:“31”,“vt”:“str”},{“t”:“eq”,“v”:“44”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:5,“x”:610,“y”:520,“wires”:[[“d64c525e.00bcb”],[“9ed113c4.be97c”],[“36355653.86eb6a”],[“d5608d9d.e3a83”],[“df6e53bc.c8604”]]},{“id”:“13de5612.c24b5a”,“type”:“split”,“z”:“fb7e78fa.9d0928”,“name”:“Split”,“splt”:"\n",“spltType”:“str”,“arraySplt”:1,“arraySpltType”:“len”,“stream”:false,“addname”:"",“x”:610,“y”:400,“wires”:[[“967f034e.d9fe4”,“72689918.0198f8”,“93211432.ad6ba8”]]},{“id”:“f8b3d90d.170978”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:590,“y”:260,“wires”:[]},{“id”:“43f246.e6370dbc”,“type”:“change”,“z”:“fb7e78fa.9d0928”,“name”:“Change Payload”,“rules”:[{“t”:“set”,“p”:“payload”,“pt”:“msg”,“to”:“payload.metrics”,“tot”:“msg”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:570,“y”:300,“wires”:[[“13de5612.c24b5a”]]},{“id”:“d5608d9d.e3a83”,“type”:“groov-write-ds”,“z”:“fb7e78fa.9d0928”,“dataStore”:“6109592a.3f4ea8”,“tagName”:“RANGER01-DIN1”,“tableStartIndex”:"",“value”:“payload.booleanValue”,“valueType”:“msg”,“name”:"",“x”:1010,“y”:560,“wires”:[[]]},{“id”:“71bdccfa.ed7b74”,“type”:“groov-write-ds”,“z”:“fb7e78fa.9d0928”,“dataStore”:“6109592a.3f4ea8”,“tagName”:“RANGER01-TEMP”,“tableStartIndex”:"",“value”:“payload.floatValue”,“valueType”:“msg”,“name”:"",“x”:1010,“y”:520,“wires”:[[]]},{“id”:“72689918.0198f8”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:810,“y”:320,“wires”:[]},{“id”:“9ed113c4.be97c”,“type”:“groov-write-ds”,“z”:“fb7e78fa.9d0928”,“dataStore”:“6109592a.3f4ea8”,“tagName”:“RANGER01-BATT”,“tableStartIndex”:"",“value”:“payload.floatValue”,“valueType”:“msg”,“name”:"",“x”:1010,“y”:480,“wires”:[[]]},{“id”:“36355653.86eb6a”,“type”:“unit-converter”,“z”:“fb7e78fa.9d0928”,“category”:“temperature”,“inputUnit”:“C”,“outputUnit”:“F”,“inputField”:“payload.floatValue”,“outputField”:“payload.floatValue”,“inputFieldType”:“msg”,“outputFieldType”:“msg”,“name”:"",“x”:820,“y”:520,“wires”:[[“71bdccfa.ed7b74”]]},{“id”:“df6e53bc.c8604”,“type”:“groov-write-ds”,“z”:“fb7e78fa.9d0928”,“dataStore”:“6109592a.3f4ea8”,“tagName”:“RANGER01-DIN2”,“tableStartIndex”:"",“value”:“payload.booleanValue”,“valueType”:“msg”,“name”:"",“x”:1010,“y”:600,“wires”:[[]]},{“id”:“e08f71ef.29683”,“type”:“mqtt in”,“z”:“fb7e78fa.9d0928”,“name”:“MQTT Subscriber - spBv1.0/none/NBIRTH/352656100597536”,“topic”:“spBv1.0/none/NBIRTH/352656100597536”,“qos”:“1”,“datatype”:“auto”,“broker”:“e8c24602.c62148”,“x”:240,“y”:920,“wires”:[[“57bce9d2.18ec28”,“5f8b9328.9e893c”]]},{“id”:“5f8b9328.9e893c”,“type”:“decode”,“z”:“fb7e78fa.9d0928”,“name”:“GoogleProtoDecoder”,“protofile”:“1a7592b8.97df6d”,“protoType”:“Payload”,“x”:360,“y”:1000,“wires”:[[“8024c310.a7571”,“b0ac4d88.2b8ad”]]},{“id”:“57bce9d2.18ec28”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:590,“y”:880,“wires”:[]},{“id”:“8024c310.a7571”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:590,“y”:960,“wires”:[]},{“id”:“b0ac4d88.2b8ad”,“type”:“change”,“z”:“fb7e78fa.9d0928”,“name”:“Change Payload”,“rules”:[{“t”:“set”,“p”:“payload”,“pt”:“msg”,“to”:“payload.metrics”,“tot”:“msg”},{“t”:“move”,“p”:“payload.name”,“pt”:“msg”,“to”:“payload.measurement”,“tot”:“msg”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:410,“y”:1120,“wires”:[[“5187970e.746ba8”]]},{“id”:“5187970e.746ba8”,“type”:“split”,“z”:“fb7e78fa.9d0928”,“name”:“Split”,“splt”:"\n",“spltType”:“str”,“arraySplt”:1,“arraySpltType”:“len”,“stream”:false,“addname”:"",“x”:450,“y”:1220,“wires”:[[“f8583832.eecc38”]]},{“id”:“f8583832.eecc38”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:750,“y”:1220,“wires”:[]},{“id”:“cbabacc5.1d02a”,“type”:“debug”,“z”:“fb7e78fa.9d0928”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:430,“y”:1080,“wires”:[]},{“id”:“93211432.ad6ba8”,“type”:“influxdb out”,“z”:“fb7e78fa.9d0928”,“influxdb”:“41553948.bbbf18”,“name”:"",“measurement”:“Ranger01”,“precision”:"",“retentionPolicy”:"",“x”:1070,“y”:400,“wires”:[]},{“id”:“bc173680.d61ae8”,“type”:“function”,“z”:“fb7e78fa.9d0928”,“name”:"",“func”:"\nreturn msg;",“outputs”:1,“noerr”:0,“x”:600,“y”:1320,“wires”:[[]]},{“id”:“e8c24602.c62148”,“type”:“mqtt-broker”,“z”:"",“name”:"",“broker”:“localhost”,“port”:“8883”,“clientid”:"",“usetls”:false,“compatmode”:false,“keepalive”:“60”,“cleansession”:true,“birthTopic”:"",“birthQos”:“0”,“birthPayload”:"",“closeTopic”:"",“closeQos”:“0”,“closePayload”:"",“willTopic”:"",“willQos”:“0”,“willPayload”:""},{“id”:“1a7592b8.97df6d”,“type”:“protobuf-file”,“z”:"",“protopath”:"/home/dev/unsecured/sparkplug_b.proto"},{“id”:“6109592a.3f4ea8”,“type”:“groov-data-store”,“z”:"",“project”:“78a9c393.fcdbec”,“dsName”:“MQTT”},{“id”:“41553948.bbbf18”,“type”:“influxdb”,“z”:"",“hostname”:“192.168.0.202”,“port”:“8086”,“protocol”:“http”,“database”:“MQTT”,“name”:"",“usetls”:false,“tls”:""},{“id”:“78a9c393.fcdbec”,“type”:“groov-project”,“z”:"",“address”:“localhost”}]

Hi Soud. Welcome to the forums.

Dan did post his flow. Here it is highlighted.

Also, we can not use your flow because you did not put it in ‘formatted text’.
You need to the use </> tool in the editor to post your flow.

Hey,

Glad to see others out there using the node. Can I ask what application you are using it in?

The reason you are not getting NBIRTH messages is because you have hard coded NDATA into your topic field.

You will need to use something like this to get all the topics needed. This way you can use all the relevant topics desired.

TOPIC
Change the GroupID and EdgeID to your specific ones.
spBv1.0/{GroupID}/+/{EdgeID}/#

Also I have updated my flow example here. It includes sending out formatted Sparkplug messages being encoded.properly.

The Signal Fire support team gave me the function template to work with.

[{"id":"8a415d7a.2a74c","type":"decode","z":"f10784d0.015068","name":"sparkplug_b","protofile":"2693e25a.9357de","protoType":"Payload","x":330,"y":100,"wires":[["11fd00c3.5b313f","183b7dfb.f32a42"]]},{"id":"fd45ee80.d16a8","type":"mqtt in","z":"f10784d0.015068","name":"groovEPIC_dev","topic":"spBv1.0/NetDNA/+/352656100597502/#","qos":"2","datatype":"auto","broker":"1008ff7a.33cd81","x":140,"y":100,"wires":[["8a415d7a.2a74c"]]},{"id":"11fd00c3.5b313f","type":"change","z":"f10784d0.015068","name":"","rules":[{"t":"move","p":"payload.metrics","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":100,"wires":[["33269ef8.0ee502"]]},{"id":"33269ef8.0ee502","type":"split","z":"f10784d0.015068","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":390,"y":360,"wires":[["9b32db74.377568"]]},{"id":"9b32db74.377568","type":"switch","z":"f10784d0.015068","name":"","property":"payload.alias","propertyType":"msg","rules":[{"t":"cont","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"7","vt":"num"},{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"11","vt":"num"},{"t":"eq","v":"12","vt":"num"},{"t":"eq","v":"13","vt":"num"},{"t":"eq","v":"31","vt":"num"},{"t":"eq","v":"44","vt":"num"},{"t":"eq","v":"57","vt":"num"},{"t":"eq","v":"58","vt":"num"},{"t":"eq","v":"59","vt":"num"}],"checkall":"true","repair":false,"outputs":12,"x":610,"y":360,"wires":[["65d16ebb.6087d"],["3abf0010.523c"],["974f946d.242268"],["18e3836b.0da06d"],["b4004d2d.05be7"],["763b09b6.3ae848"],["fd3d54ee.af9868"],["ad585bae.75c758"],["c53eab55.1ea6e8"],["bf774233.28f1e"],["d0382c24.35db4"],["7695ca3e.6f87e4"]],"outputLabels":["Node Control/Group ID","Properties/HW Rev","Properties/SW Rev","Properties/Name","Temperature","Battery","ConnectTime","Dev1/DIN1","Dev1/DIN2","Dev1/DOUT1","Dev1/AIN1","Dev1/AIN1 Raw"]},{"id":"1784a97b.701097","type":"debug","z":"f10784d0.015068","name":"fv","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1070,"y":360,"wires":[]},{"id":"65d16ebb.6087d","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"4","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":160,"wires":[["1784a97b.701097"]]},{"id":"974f946d.242268","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"7","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":240,"wires":[["1784a97b.701097"]]},{"id":"3abf0010.523c","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"5","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":200,"wires":[["1784a97b.701097"]]},{"id":"18e3836b.0da06d","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"8","tableStartIndex":"","value":"payload.stringValue","valueType":"msg","name":"","x":810,"y":280,"wires":[["1784a97b.701097"]]},{"id":"b4004d2d.05be7","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"11","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":320,"wires":[["1784a97b.701097"]]},{"id":"763b09b6.3ae848","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"12","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":360,"wires":[["1784a97b.701097"]]},{"id":"d0382c24.35db4","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"58","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":560,"wires":[["1784a97b.701097"]]},{"id":"bf774233.28f1e","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"57","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":520,"wires":[["1784a97b.701097"]]},{"id":"c53eab55.1ea6e8","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"44","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":480,"wires":[["1784a97b.701097"]]},{"id":"ad585bae.75c758","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"31","tableStartIndex":"","value":"payload.booleanValue","valueType":"msg","name":"","x":810,"y":440,"wires":[["1784a97b.701097"]]},{"id":"7695ca3e.6f87e4","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"59","tableStartIndex":"","value":"payload.floatValue","valueType":"msg","name":"","x":810,"y":600,"wires":[["1784a97b.701097"]]},{"id":"183b7dfb.f32a42","type":"debug","z":"f10784d0.015068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":200,"wires":[]},{"id":"fd3d54ee.af9868","type":"groov-write-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"13","tableStartIndex":"","value":"payload.longValue","valueType":"msg","name":"","x":810,"y":400,"wires":[["1784a97b.701097"]]},{"id":"8b8f8d4.5166a7","type":"inject","z":"f10784d0.015068","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":720,"wires":[["c8e999ef.f66df8"]]},{"id":"29f44c8e.711f34","type":"mqtt out","z":"f10784d0.015068","name":"","topic":"","qos":"","retain":"","broker":"1008ff7a.33cd81","x":990,"y":720,"wires":[]},{"id":"af27afd3.3c2d2","type":"function","z":"f10784d0.015068","name":"","func":"\nvar do1 = msg.payload;\n\n\n\nvar group_id = \"NetDNA\";       // Put Sparkplug group ID here\n\nvar edge_node_id = \"352656100597502\"; // Put Sparkplug edge node ID here\n\nmsg.qos = 1;\n\nmsg.retain = false;\n\nmsg.topic = \"spBv1.0/\" + group_id + \"/NCMD/\" + edge_node_id;\n\n       \n\nvar dout1_metric = {\n\nname: \"Dev1/DOUT1\",\n\ntimestamp: Date.now(),\n\ndatatype: 11,\n\nbooleanValue: do1\n\n};\n\n//msg.protobufType = 'encode'; \n\nvar payload = {\n\ntimestamp: Date.now(),\n\nseq: -1,\n\nmetrics: [dout1_metric]\n\n};\n\n \n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":720,"wires":[["5ac3043f.78453c","146daae5.d89fb5"]]},{"id":"5ac3043f.78453c","type":"debug","z":"f10784d0.015068","name":"send","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":890,"y":780,"wires":[]},{"id":"146daae5.d89fb5","type":"encode","z":"f10784d0.015068","name":"encode","protofile":"2693e25a.9357de","protoType":"Payload","x":800,"y":720,"wires":[["29f44c8e.711f34","5ac3043f.78453c"]]},{"id":"8f7fac19.bca7c","type":"rbe","z":"f10784d0.015068","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":450,"y":720,"wires":[["af27afd3.3c2d2"]]},{"id":"c8e999ef.f66df8","type":"groov-read-ds","z":"f10784d0.015068","dataStore":"f216f435.690668","tagName":"do1","tableStartIndex":"","tableLength":"","value":"","valueType":"msg.payload","topic":"","topicType":"none","name":"","x":290,"y":720,"wires":[["ed33fdda.a10ab","8f7fac19.bca7c"]]},{"id":"ed33fdda.a10ab","type":"debug","z":"f10784d0.015068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":390,"y":660,"wires":[]},{"id":"2c2434ce.35dffc","type":"comment","z":"f10784d0.015068","name":"Get MQTT messages","info":"","x":140,"y":60,"wires":[]},{"id":"421a6068.50a64","type":"comment","z":"f10784d0.015068","name":"Send MQTT messages","info":"","x":160,"y":620,"wires":[]},{"id":"2693e25a.9357de","type":"protobuf-file","z":"","protopath":"/home/dev/unsecured/sparkplug_b.proto"},{"id":"1008ff7a.33cd81","type":"mqtt-broker","z":"","name":"Chariot","broker":"postman.cloudmqtt.com","port":"13650","tls":"","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f216f435.690668","type":"groov-data-store","z":"","project":"f7cad6e5.05f6f8","dsName":"sfr"},{"id":"f7cad6e5.05f6f8","type":"groov-project","z":"","address":"localhost"}]

Regards,
Dan

1 Like

I apologize, as that was my first post on the forum. Thanks for pointing out Dan’s original post.

1 Like

Thank you soo much. That worked beautifully. My application is for collecting pressures (PSIG) from hundreds of sensors spread out over about 5,000,000 sq mi area.

Also, another issue I’m having. I spoke with Signal-Fire to ask about the “alias” number that are sent in the periodic NDATA messages. and they stated that they are defined in the initial “NBIRTH” message. And that the alias numbers can/may change in future firmware, so I shouldn’t hardcode alias numbers to Tag name. So, I will have to work on some kind of index/table to set the alias numbers to their corresponding tag name.

I know that you were also looking for the tag structure and this is the one Signal-Fire sent me:

Ranger Tag Guide v0.1.6.zip (20.4 KB)

Glad that it helped. Took me a bit to figure out where to even find alias’s without the Tag Guide.

Thanks for sharing the guide, very helpful!