Jeffrey Osborne
Forum Replies Created
-
AuthorPosts
-
January 26, 2017 at 12:10 pm in reply to: Not understanding payload from mDot Box in node-RED #16481
Jeffrey Osborne
ParticipantAwesome leon, thanks for the info. I just want to add something as well for others. If you place a debug node on msg.payload, I receive something like 0E07080A080602DE0500460B01D0 (this is a different payload than the one above). This can be interpreted easily as well as:
0E = Acceleration, next 3 bytes
07 = 7 x 0.0625 = 0.4375 g (x)
08 = 8 x 0.0625 = 0.5 g (y)
0A = 10 x 0.0625 = 0.625 g (z)08 = Pressure, next 3 bytes
0602DE = 393950 x 0.25 = 98,786.5 Pa (I believe the documentation is incorrect and it should be <value x 0.25Pa> instead of kPa)05 = Lux, next 2 bytes
0046 = 70 lumens0B = Temperature, next 2 bytes
01D0 = 464 x 0.0625 = 29CJanuary 26, 2017 at 10:25 am in reply to: Not understanding payload from mDot Box in node-RED #16479Jeffrey Osborne
ParticipantHi all,
I’m also having issues understanding the format of the data. My node-red is configured with a LoRa input node attached to a debug node. When the lora node is configured in UTF-8, the debug looks like:
{ "chan": 7, "cls": 0, "codr": "4/5", "datr": "SF7BW125", "freq": "913.3", "lsnr": "10.2", "mhdr": "4001000000001a00", "modu": "LORA", "opts": "", "port": 1, "rfch": 1, "rssi": -47, "seqn": 26, "size": 20, "timestamp": "2017-01-26T16:07:10.388956Z", "tmst": 1756279708, "payload": "\u000e��\u000f\b\u0006\u0002z\u0005\u0000�\u000b\u0001�", "eui": "00-80-00-00-00-00-c7-XX", "_msgid": "22fbc053.dd044" }
Conversely, when the lora node is in Bytes format, it looks like:
{ "chan": 2, "cls": 0, "codr": "4/5", "datr": "SF7BW125", "freq": "912.3", "lsnr": "10.2", "mhdr": "4001000000006d00", "modu": "LORA", "opts": "", "port": 1, "rfch": 0, "rssi": -35, "seqn": 109, "size": 20, "timestamp": "2017-01-26T16:24:51.745114Z", "tmst": 2817660067, "payload": [ 14, 255, 255, 15, 8, 6, 2, 111, 5, 0, 77, 11, 1, 208 ], "eui": "00-80-00-00-00-00-c7-XX", "_msgid": "eaef34ae.1510c8" }
I am using the mDot Box in the LoRa demo mode. I read the description in http://www.multitech.net/developer/software/dot-box-and-evb-software/data-packet-format/ but didn’t really understand the formatting still.
Jeffrey Osborne
ParticipantV0.11.1 yep, my bad.
That’s a bummer that there are no updates past this. Specifically, in 0.11.1 I don’t see the functionality for flow.x or global.x variables. Am I missing something obvious or is this in fact not in 0.11.1?
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
Jeffrey Osborne
ParticipantI was able to get something working using a locally hosted node-red application (i.e. on my PC, not the multitech). I was using mySQL and some flow.* variables to save variables while the flow is deployed. I have included my flow below, you would need to update the mysql nodes to include your own database though.
I don’t know anything yet about hosting the sqlite on the conduit. I will take a look at this and report back if I get anywhere with it.
[{"id":"8b281012.0959f","type":"inject","z":"4b270a81.bcaf04","name":"Initialize","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":123,"y":97,"wires":[["d4e0a72c.869818"]]},{"id":"d4e0a72c.869818","type":"function","z":"4b270a81.bcaf04","name":"Initialize Inject Counter","func":"var injects = 0; \nflow.set('injects', injects); \n\nvar DeviceID = flow.get('DeviceID')||[]; DeviceID = []; flow.set('DeviceID', DeviceID); \nvar currentDate = flow.get('currentDate')||[]; currentDate = []; flow.set('currentDate', currentDate);\nvar temperature = flow.get('temperature')||[]; temperature = []; flow.set('temperature', temperature); ","outputs":1,"noerr":0,"x":345,"y":97,"wires":[[]]},{"id":"2a322e48.cc4862","type":"function","z":"4b270a81.bcaf04","name":"Remove Arrays","func":"var injects = 0; \nflow.set('injects', injects); \n\nvar DeviceID = flow.get('DeviceID')||[]; DeviceID = []; flow.set('DeviceID', DeviceID); \nvar currentDate = flow.get('currentDate')||[]; currentDate = []; flow.set('currentDate', currentDate);\nvar temperature = flow.get('temperature')||[]; temperature = []; flow.set('temperature', temperature); \n\nmsg.DeviceID = DeviceID; \nmsg.currentDate = currentDate; \nmsg.temperature = temperature; \nmsg.output = \"Data sent\"; \n\nreturn msg; \n","outputs":1,"noerr":0,"x":1036,"y":392,"wires":[["1ea9446f.aa50dc","e4f0e7a7.eb2228","e2633138.fa57d","1934a010.f1b6b"]]},{"id":"e1f4b6bd.cb4098","type":"function","z":"4b270a81.bcaf04","name":"Create Readings","func":"function getRandomArbitrary(min, max) {\n return Math.random() * (max - min) + min;\n}\n\n//DEFINE VARIABLES//\nvar NumDevices = 2; \ninjects = flow.get('injects'); \nDeviceID = flow.get('DeviceID'); \ncurrentDate = flow.get('currentDate'); \ntemperature = flow.get('temperature'); \n\n//CREATE NEW DATABASE ENTIRES//\nfor (i = (injects-1)*NumDevices; i < (injects*NumDevices); i++){\n DeviceID[i] = i - (injects - 1)*NumDevices; \n currentDate[i] = new Date().toISOString().slice(0, 19).replace('T', ' '); \n temperature[i] = getRandomArbitrary(20, 30); \n}\n\nflow.set('DeviceID', DeviceID);\nflow.set('currentDate', currentDate); \nflow.set('temperature', temperature); \n\nmsg.injects = injects; \nmsg.DeviceID = DeviceID; \nmsg.currentDate = currentDate; \nmsg.temperature = temperature; \n\nmsg.output = \"Measurement Taken\"; \n\nreturn msg; ","outputs":1,"noerr":0,"x":600,"y":156,"wires":[["1062d6a8.56e869","3c001f50.b38bf","c16c3b08.d90fc8","e22ccd12.d980a","c6b000.edba6"]]},{"id":"e6d5ba6b.0cdbf8","type":"inject","z":"4b270a81.bcaf04","name":"Inject Readings","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"x":149,"y":155,"wires":[["f19ae38b.b7faa"]]},{"id":"f19ae38b.b7faa","type":"function","z":"4b270a81.bcaf04","name":"Create Variables","func":"injects = flow.get('injects'); injects += 1;\nflow.set('injects', injects); \nmsg.injects = injects; \n\n\nreturn msg; ","outputs":1,"noerr":0,"x":367,"y":156,"wires":[["e1f4b6bd.cb4098"]]},{"id":"3029d034.10ee1","type":"inject","z":"4b270a81.bcaf04","name":"TX Injection","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"x":132,"y":295,"wires":[["29f93eb9.019da2"]]},{"id":"1062d6a8.56e869","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"injects","x":829,"y":74,"wires":[]},{"id":"521ad365.803dbc","type":"function","z":"4b270a81.bcaf04","name":"Query Last ID","func":"msg.topic = \"SELECT ID FROM sensorsimulation.SensorReadings ORDER BY id DESC limit 1\";\n\nreturn msg; \n\n\n ","outputs":1,"noerr":0,"x":563,"y":292,"wires":[["2c3ecc94.e5e634"]]},{"id":"d937690f.938518","type":"function","z":"4b270a81.bcaf04","name":"Prepare Payload","func":"var ID = msg.payload[0][\"ID\"] + 1; \n\n//SET VARIABLES//\nvar DeviceID = flow.get('DeviceID'); \nvar currentDate = flow.get('currentDate'); \nvar temperature = flow.get('temperature'); \nvar i = flow.get('i'); \n\n//CREATE PAYLOAD//\nmsg.topic = \"INSERT INTO SensorReadings (ID, DeviceID, TimeStamp, Reading) VALUES (?,?,?,?)\";\nmsg.payload = [ID, DeviceID[i], currentDate[i], temperature[i]];\n\nmsg.i = i;\n\nif (i == DeviceID.length - 1){\n var stop = flow.get('stop'); stop = 1; flow.set('stop', stop); //Sets stop = 1 if reach end of array\n}else{\n i += 1; flow.set('i', i); //Else, increase i\n}\n\nmsg.stop = flow.get('stop'); \n\nreturn msg; ","outputs":1,"noerr":0,"x":954,"y":291,"wires":[["6b27963b.116a78","78331081.e7d21","507726d7.057028","135c0b89.087044"]]},{"id":"6b27963b.116a78","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"payload","x":1190,"y":174,"wires":[]},{"id":"3c001f50.b38bf","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"temperature","x":847,"y":123,"wires":[]},{"id":"29f93eb9.019da2","type":"function","z":"4b270a81.bcaf04","name":"Initialize Loop Counter","func":"var i = 0; flow.set('i', i); \n\nvar stop = 0; flow.set('stop', stop); //Stop the loop indicator\n\nmsg.i = i; \n\nreturn msg; \n","outputs":1,"noerr":0,"x":332,"y":295,"wires":[["521ad365.803dbc","57b8aece.1987d"]]},{"id":"57b8aece.1987d","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"i","x":539,"y":236,"wires":[]},{"id":"78331081.e7d21","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"i","x":1168,"y":129,"wires":[]},{"id":"dbb58db.43f537","type":"switch","z":"4b270a81.bcaf04","name":"Exit Loop Check","property":"stop","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":822,"y":387,"wires":[["521ad365.803dbc"],["2a322e48.cc4862"]]},{"id":"507726d7.057028","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"stop","x":1180,"y":225,"wires":[]},{"id":"c16c3b08.d90fc8","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"DeviceID","x":838,"y":169,"wires":[]},{"id":"e22ccd12.d980a","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"currentDate","x":846,"y":213,"wires":[]},{"id":"1ea9446f.aa50dc","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"temperature","x":1242,"y":392,"wires":[]},{"id":"e4f0e7a7.eb2228","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"DeviceID","x":1235,"y":437,"wires":[]},{"id":"e2633138.fa57d","type":"debug","z":"4b270a81.bcaf04","name":"","active":false,"console":"false","complete":"currentDate","x":1243,"y":481,"wires":[]},{"id":"c6b000.edba6","type":"debug","z":"4b270a81.bcaf04","name":"","active":true,"console":"false","complete":"output","x":834,"y":256,"wires":[]},{"id":"1934a010.f1b6b","type":"debug","z":"4b270a81.bcaf04","name":"","active":true,"console":"false","complete":"output","x":1223,"y":525,"wires":[]},{"id":"2c3ecc94.e5e634","type":"mysql","z":"4b270a81.bcaf04","mydb":"","name":"","x":747,"y":301,"wires":[["d937690f.938518"]]},{"id":"135c0b89.087044","type":"mysql","z":"4b270a81.bcaf04","mydb":"","name":"","x":1171,"y":281,"wires":[["dbb58db.43f537"]]}]
Jeffrey Osborne
ParticipantHi all, was hoping to revive this topic. I am also trying to update node-red, but my version says 0.0.0, I’m not sure how to update even to 0.11.1. How would I go about this?
Jeffrey Osborne
ParticipantWas hoping to revive this old post. I also have the problem of wanting to store data locally on the multitech. Was anyone able to figure out how to create a database on the conduit or is the solution still to use the context.global array?
Jeffrey Osborne
ParticipantI think I got this working. I’m honestly not sure what I did to solve it, but since my last message I unticked “enable”, restarted the conduit, and tried re-installing the node via
npm install node-red-node-mysql
and it worked.When it doubt..turn it off and on…
Jeffrey Osborne
ParticipantOne last thing I just realized. In my npm-debug file, I have the following:
0 info it worked if it ends with ok 1 verbose cli [ 'node', '/usr/bin/npm', 'install', 'node-red-node-mysql' ] 2 info using npm@1.4.28 3 info using node@v0.10.40 4 verbose cache add [ 'node-red-node-mysql', null ] 5 verbose cache add name=undefined spec="node-red-node-mysql" args=["node-red-node-mysql",null] 6 verbose parsed url { protocol: null, 6 verbose parsed url slashes: null, 6 verbose parsed url auth: null, 6 verbose parsed url host: null, 6 verbose parsed url port: null, 6 verbose parsed url hostname: null, 6 verbose parsed url hash: null, 6 verbose parsed url search: null, 6 verbose parsed url query: null, 6 verbose parsed url pathname: 'node-red-node-mysql', 6 verbose parsed url path: 'node-red-node-mysql', 6 verbose parsed url href: 'node-red-node-mysql' } 7 silly makeCacheDir cache dir uid, gid [ 0, 0 ] 8 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql 9 verbose lock node-red-node-mysql /home/root/.npm/dbd87e05-node-red-node-mysql.lock 10 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql 11 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql 12 verbose addNamed [ 'node-red-node-mysql', '' ] 13 verbose addNamed [ null, '*' ] 14 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@ 15 verbose lock node-red-node-mysql@ /home/root/.npm/313b7776-node-red-node-mysql.lock 16 silly addNameRange { name: 'node-red-node-mysql', range: '*', hasData: false } 17 verbose request where is /node-red-node-mysql 18 verbose request registry https://registry.npmjs.org/ 19 verbose request id e85f32bedf8a2218 20 verbose url raw /node-red-node-mysql 21 verbose url resolving [ 'https://registry.npmjs.org/', './node-red-node-mysql' ] 22 verbose url resolved https://registry.npmjs.org/node-red-node-mysql 23 verbose request where is https://registry.npmjs.org/node-red-node-mysql 24 info trying registry request attempt 1 at 23:09:10 25 http GET https://registry.npmjs.org/node-red-node-mysql 26 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND 27 info trying registry request attempt 2 at 23:09:22 28 http GET https://registry.npmjs.org/node-red-node-mysql 29 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND 30 info trying registry request attempt 3 at 23:10:22 31 http GET https://registry.npmjs.org/node-red-node-mysql 32 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@ 33 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@ 34 error network getaddrinfo ENOTFOUND 34 error network This is most likely not a problem with npm itself 34 error network and is related to network connectivity. 34 error network In most cases you are behind a proxy or have bad network settings. 34 error network 34 error network If you are behind a proxy, please make sure that the 34 error network 'proxy' config is set properly. See: 'npm help config' 35 error System Linux 3.12.27 36 error command "node" "/usr/bin/npm" "install" "node-red-node-mysql" 37 error cwd / 38 error node -v v0.10.40 39 error npm -v 1.4.28 40 error syscall getaddrinfo 41 error code ENOTFOUND 42 error errno ENOTFOUND 43 verbose exit [ 1, true ]
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
Jeffrey Osborne
ParticipantResponse to Heath
I was able to connect it to the internet, that was one of the issues. For others: I didn’t have my gateway and DNS configured. When I execute
ping google.com
I get the following:PING google.com (216.58.219.206) 56(84) bytes of data. 64 bytes from lga25s40-in-f14.1e100.net (216.58.219.206): icmp_seq=1 ttl=56 time=20.3 ms 64 bytes from lga25s40-in-f14.1e100.net (216.58.219.206): icmp_seq=2 ttl=56 time=20.4 ms
I then executed
npm install node-red-node-mysql
in/opt/node-red/nodes
, and it appeared to work correctly. In/opt/node-red/node_modules
I now seenode-red-node-mysql
. However, it still does not appear in node-red after restarting the conduit.Some additional information. Inside of node-red.log, I have the following:
Welcome to Node-RED =================== 23 Jan 17:21:10 - [info] Node-RED version: v0.11.1 23 Jan 17:21:10 - [info] Node.js version: v0.10.40 23 Jan 17:21:10 - [info] Loading palette nodes 23 Jan 17:25:53 - [warn] ------------------------------------------ 23 Jan 17:25:53 - [warn] Failed to register 1 node type 23 Jan 17:25:53 - [warn] Run with -v for details 23 Jan 17:25:53 - [warn] ------------------------------------------ 23 Jan 17:25:53 - [info] Settings file : /var/config/app/install/development/settings.js 23 Jan 17:25:53 - [info] User directory : /var/config/app/install/development 23 Jan 17:25:53 - [info] Flows file : /var/config/app/install/development/flows.json 23 Jan 17:25:54 - [info] Server now running at http://127.0.0.1:1881/ 23 Jan 17:25:54 - [info] Creating new flow file 23 Jan 17:25:55 - [info] Starting flows 23 Jan 17:25:55 - [info] Started flows
So it looks like there is still an issue with the node. When I execute
/opt/node-red/bin/node-red-pi -v
I get an error regarding already using the ports. I don’t have node-red open when I execute this, not sure what causes this:Welcome to Node-RED =================== 23 Jan 18:25:22 - [info] Node-RED version: v0.11.1 23 Jan 18:25:22 - [info] Node.js version: v0.10.40 23 Jan 18:25:22 - [info] Loading palette nodes 23 Jan 18:26:53 - [info] Settings file : /opt/node-red/settings.js 23 Jan 18:26:54 - [info] User directory : /home/root/.node-red 23 Jan 18:26:54 - [info] Flows file : /home/root/.node-red/flows_mtcdt.json 23 Jan 18:26:54 - [warn] Communication server error: Error: listen EADDRINUSE 23 Jan 18:26:54 - [error] Unable to listen on http://127.0.0.1:1880/ 23 Jan 18:26:54 - [error] Error: port in use
Still unable to get the mySQL node into node-red, any thoughts?
Jeffrey Osborne
ParticipantResponse to Heath Raftery:
I placed
package.json
in/opt/node-red/nodes/core/storage
, and restarted the Conduit, but that didn’t fix the issue. Here is mynode-red.log
:18 Jan 19:26:16 - [info] Node-RED version: v0.11.1 18 Jan 19:26:16 - [info] Node.js version: v0.10.40 18 Jan 19:26:16 - [info] Loading palette nodes 18 Jan 19:27:32 - [warn] ------------------------------------------ 18 Jan 19:27:32 - [warn] Failed to register 1 node type 18 Jan 19:27:32 - [warn] Run with -v for details 18 Jan 19:27:32 - [warn] ------------------------------------------ 18 Jan 19:27:32 - [info] Settings file : /var/config/app/install/development/settings.js 18 Jan 19:27:32 - [info] User directory : /var/config/app/install/development 18 Jan 19:27:32 - [info] Flows file : /var/config/app/install/development/flows.json 18 Jan 19:27:33 - [info] Server now running at http://127.0.0.1:1881/ 18 Jan 19:27:33 - [info] Creating new flow file 18 Jan 19:27:33 - [info] Starting flows 18 Jan 19:27:33 - [info] Started flows
Response to Jason Reiss:
It is yeah, but I’m getting the following error when I execute
nslookup google.com
:Server: 127.0.0.1 Address 1: 127.0.0.1 localhost.localdomain nslookup: can't resolve 'google.com'
Which leads me to believe that I’m not connected to the internet…which doesn’t seem right.
Jeffrey Osborne
ParticipantI’m going to jump into this conversation as I’m having the same issue and not sure how to resolve it.
I am trying to add a node, specifically a mysql node). I attempted the following:
1) Copy and past the 68-mysql.html and 68-mysql.json files from the above link to
/opt/node-red/nodes/core/storage
. Restarted the Conduit, but the mySQL node was not added. I looked at the .config file, and it was updated to include the 68-mysql files. The entry looks like:
`”mysql”: {
“name”: “mysql”,
“types”: [
“MySQLdatabase”,
“mysql”
],
“enabled”: true,
“module”: “node-red”,
“file”: “/opt/node-red/nodes/core/storage/68-mysql.js”
}`2) I tried to add this node via npm (I SSH’d into the Conduit using PuTTY). I did the following
cd /opt/node-red/nodes
npm install node-red-node-mysql
From that, I got the following error`npm WARN package.json mts-gpio@ No descriptionnpm WARN package.json mts-gpio@ No repository field. npm WARN package.json mts-gpio@ No README data npm WARN package.json mts-mcard@ No description npm WARN package.json mts-mcard@ No repository field. npm WARN package.json mts-mcard@ No README data npm WARN package.json mts-serial@ No description npm WARN package.json mts-serial@ No repository field. npm WARN package.json mts-serial@ No README data npm ERR! network getaddrinfo ENOTFOUND npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! System Linux 3.12.27 npm ERR! command "node" "/usr/bin/npm" "install" "node-red-node-mysql" npm ERR! cwd /opt/node-red/nodes npm ERR! node -v v0.10.40 npm ERR! npm -v 1.4.28 npm ERR! syscall getaddrinfo npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /opt/node-red/nodes/npm-debug.log npm ERR! not ok code 0
And alas, the node hasn’t been added to node-red on the Conduit :(. Anyone know what is the cause of this?
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
-
This reply was modified 8 years, 3 months ago by
Jeffrey Osborne.
-
This reply was modified 8 years, 3 months ago by
-
AuthorPosts