Wireless to Ethernet Modems

I have numerous (~25) Wireless Temperature / Humidity Sensor nodes all pointed to a single NCD Wireless to Ethernet modem. I am getting this message every ~0.10 seconds in the terminal window. When I had started adding nodes this didn’t start happening until I had a larger number of nodes in the flow (just an observation, perhaps not related).

{ Error: connect ECONNREFUSED 10.0.1.185:2101
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
errno: ‘ECONNREFUSED’,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘10.0.1.185’,
port: 2101 }

Below is a flow that I have copied and edited for each specific node, changing, the specific information for each node (MAC address along with other basic information - names, gauge stuff, etc.) Also you can ignore the SQL node for now as I thought this issue may have been related to that, but after clearing out all the SQL nodes there was no change. Also you can ignore the email node as I have it incomplete so Im not getting blasted with temp/humid. alarms during this setup process.

Running node-red on Ubuntu Client 18.04.3 LTS. Node-Red version v0.20.8, Node.js version: v10.16.3


[{"id":"e1f6a792.4ccff","type":"tab","label":"Troubleshooting flows","disabled":false,"info":""},{"id":"4fbb5e7d.7825b8","type":"ncd-wireless-node","z":"e1f6a792.4ccff","name":"Room 27 - Washroom 2","connection":"2ad09763.ded33","config_comm":"2ad09763.ded33","addr":"00:13:a2:00:41:99:73:44","sensor_type":"1","auto_config":true,"node_id":"21","delay":"300","destination":"0000FFFF","power":4,"retries":10,"pan_id":"7FFF","change_enabled":"","change_pr":"0","change_interval":"0","cm_calibration":"60.6","bp_altitude":"0","bp_pressure":"0","bp_temp_prec":"0","bp_press_prec":"0","amgt_accel":"0","amgt_mag":"0","amgt_gyro":"0","impact_accel":"0","impact_data_rate":"4","impact_threshold":25,"impact_duration":1,"activ_interr_x":1,"activ_interr_y":2,"activ_interr_z":4,"activ_interr_op":8,"filtering":0,"data_rate":5,"time_series":0,"reading_type":1,"x":401,"y":569,"wires":[["40c75a4b.8d677c","2fa271fa.fcd926","4c666388.5ff3c4","82b2b9de.905ec8"]]},{"id":"40c75a4b.8d677c","type":"change","z":"e1f6a792.4ccff","name":"CtF","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.temperature*1.8+32","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":861,"y":329,"wires":[["19703615.f5f2fa","f8fd09bd.313f7","d53f628e.9898a"]]},{"id":"2fa271fa.fcd926","type":"change","z":"e1f6a792.4ccff","name":"Humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.humidity","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":851,"y":889,"wires":[["3cab4236.a70a36","6f3e8421.cfaabc","157e9262.2c92ae"]]},{"id":"4c666388.5ff3c4","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"inalarm","pt":"flow","to":"No","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":801,"y":629,"wires":[[]]},{"id":"19703615.f5f2fa","type":"ui_gauge","z":"e1f6a792.4ccff","name":"Temperature","group":"913d8cd6.91de98","order":1,"width":"5","height":"5","gtype":"gage","title":"Temperature","label":"ºF","format":"{{value | number: 2}}","min":"50","max":"77","colors":["#00b500","#00b500","#ca3838"],"seg1":"","seg2":"75","x":1011,"y":249,"wires":[]},{"id":"f8fd09bd.313f7","type":"ui_chart","z":"e1f6a792.4ccff","name":"","group":"913d8cd6.91de98","order":4,"width":"5","height":"5","label":"Temp. Chart","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"step","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1001,"y":409,"wires":[[]]},{"id":"d53f628e.9898a","type":"switch","z":"e1f6a792.4ccff","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"77","vt":"str"},{"t":"lt","v":"50","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1121,"y":329,"wires":[["988ab213.575928"],["939631e1.b517b8"]]},{"id":"3cab4236.a70a36","type":"ui_gauge","z":"e1f6a792.4ccff","name":"Humidity","group":"26dc1ec3.4c88da","order":1,"width":"5","height":"5","gtype":"gage","title":"Humidity","label":"%RH","format":"{{value | number: 2}}","min":"10","max":"50","colors":["#00b500","#00b500","#ca3838"],"seg1":"25","seg2":"45","x":991,"y":809,"wires":[]},{"id":"6f3e8421.cfaabc","type":"ui_chart","z":"e1f6a792.4ccff","name":"","group":"26dc1ec3.4c88da","order":4,"width":"5","height":"5","label":"Humidity Chart","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"step","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":991,"y":989,"wires":[[]]},{"id":"157e9262.2c92ae","type":"switch","z":"e1f6a792.4ccff","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"45","vt":"str"},{"t":"lt","v":"10","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1051,"y":889,"wires":[["f3f0421a.11be48"],["50fa32e0.95d844"]]},{"id":"988ab213.575928","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"High Temp. Alert in Room 27 (Washroom 2)!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1311,"y":249,"wires":[["6d8e4f34.403708","8dc0d8c4.e9f588"]]},{"id":"939631e1.b517b8","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Low Temp. Alert in Room 27 (Washroom 2)!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1311,"y":409,"wires":[["c5e373af.0f857","5443f179.0f0d88"]]},{"id":"f3f0421a.11be48","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"High Humidity Alert in Room 27  (Washroom 2)!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1201,"y":789,"wires":[["26cb4a5a.e4869e","8d96d6a4.1cb8c8"]]},{"id":"50fa32e0.95d844","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Low Humidity Alert in Room 27 (Washroom 2)!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1203.999984741211,"y":989,"wires":[["97d11e5b.cfcd78","35a374c6.6bd1b4"]]},{"id":"6d8e4f34.403708","type":"template","z":"e1f6a792.4ccff","name":"High Alert","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"The temperature is above acceptable limits!! ({{payload}}F)","output":"str","x":1501,"y":249,"wires":[["63f0e59a.86aca4"]]},{"id":"8dc0d8c4.e9f588","type":"function","z":"e1f6a792.4ccff","name":"set inalarm","func":"//var inalarmL='No';\nmsg.inalarm='Yes';\n//flow.set(inalarmL,inalarm);\nreturn msg;","outputs":1,"noerr":0,"x":1511,"y":169,"wires":[["cd53147e.a4c6b"]]},{"id":"c5e373af.0f857","type":"template","z":"e1f6a792.4ccff","name":"Low Alert","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"The temperature is below acceptable limits!! ({{payload}}F)","output":"str","x":1511,"y":409,"wires":[["63f0e59a.86aca4"]]},{"id":"5443f179.0f0d88","type":"function","z":"e1f6a792.4ccff","name":"set inalarm","func":"//var inalarmL='No';\nmsg.inalarm='Yes';\n//flow.set(inalarmL,inalarm);\nreturn msg;","outputs":1,"noerr":0,"x":1511,"y":469,"wires":[["b403ead1.18711"]]},{"id":"26cb4a5a.e4869e","type":"template","z":"e1f6a792.4ccff","name":"High Alert","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"The humidity is above acceptable limits!! ({{payload}} %RH)","output":"str","x":1381,"y":789,"wires":[["ab6ee7d5.02abb"]]},{"id":"8d96d6a4.1cb8c8","type":"function","z":"e1f6a792.4ccff","name":"set inalarm","func":"//var inalarmL='No';\nmsg.inalarm='Yes';\n//flow.set(inalarmL,inalarm);\nreturn msg;","outputs":1,"noerr":0,"x":1411,"y":729,"wires":[["293b9ad8.474fb6"]]},{"id":"97d11e5b.cfcd78","type":"template","z":"e1f6a792.4ccff","name":"Low Alert","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"The humidity is below acceptable limits!! ({{payload}} %RH)","output":"str","x":1391,"y":989,"wires":[["ab6ee7d5.02abb"]]},{"id":"35a374c6.6bd1b4","type":"function","z":"e1f6a792.4ccff","name":"set inalarm","func":"//var inalarmL='No';\nmsg.inalarm='Yes';\n//flow.set(inalarmL,inalarm);\nreturn msg;","outputs":1,"noerr":0,"x":1391,"y":1049,"wires":[["de0bc38d.ccfcc8"]]},{"id":"63f0e59a.86aca4","type":"delay","z":"e1f6a792.4ccff","name":"1 msg / 30 minutes","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1751,"y":329,"wires":[["210f4d0a.96b52a"]]},{"id":"cd53147e.a4c6b","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"inalarm","pt":"flow","to":"inalarm","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1711,"y":169,"wires":[[]]},{"id":"b403ead1.18711","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"inalarm","pt":"flow","to":"inalarm","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1711,"y":469,"wires":[[]]},{"id":"293b9ad8.474fb6","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"inalarm","pt":"flow","to":"inalarm","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1611,"y":729,"wires":[[]]},{"id":"de0bc38d.ccfcc8","type":"change","z":"e1f6a792.4ccff","name":"","rules":[{"t":"set","p":"inalarm","pt":"flow","to":"inalarm","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1591,"y":1049,"wires":[[]]},{"id":"210f4d0a.96b52a","type":"e-mail","z":"e1f6a792.4ccff","server":"smtp.office365.com","port":"587","secure":false,"tls":true,"name":"XX","dname":"Send emal alert","x":1981,"y":329,"wires":[]},{"id":"3aa52487.e26334","type":"e-mail","z":"e1f6a792.4ccff","server":"smtp.office365.com","port":"587","secure":false,"tls":true,"name":"XX","dname":"Send emal alert","x":1831,"y":889,"wires":[]},{"id":"9d544aff.a4bcd8","type":"ui_text","z":"e1f6a792.4ccff","group":"26dc1ec3.4c88da","order":2,"width":0,"height":0,"name":"","label":"Min. Acceptable is 10% RH","format":"","layout":"row-left","x":1286.0000457763672,"y":854,"wires":[]},{"id":"1f601a1f.6357ee","type":"ui_text","z":"e1f6a792.4ccff","group":"26dc1ec3.4c88da","order":3,"width":0,"height":0,"name":"","label":"Max. Acceptable is 50% RH","format":"","layout":"row-left","x":1296.0000457763672,"y":894,"wires":[]},{"id":"ff5da75c.c82c28","type":"ui_text","z":"e1f6a792.4ccff","group":"913d8cd6.91de98","order":3,"width":0,"height":0,"name":"","label":"Max. Acceptable is 77F","format":"","layout":"row-left","x":1356.0000457763672,"y":354,"wires":[]},{"id":"cf39ca12.020a18","type":"ui_text","z":"e1f6a792.4ccff","group":"913d8cd6.91de98","order":2,"width":0,"height":0,"name":"","label":"Min. Acceptable is 50F","format":"","layout":"row-left","x":1366.0000457763672,"y":314,"wires":[]},{"id":"82b2b9de.905ec8","type":"MSSQL","z":"e1f6a792.4ccff","mssqlCN":"","name":"MSSQL","query":"INSERT INTO [temperaturehumidity] (temp,humidity,nodeID,voltage,SensorName,InAlarm) VALUES ({{{payload.temperature}}}*1.8+32,{{{payload.humidity}}},{{{data.nodeId}}},{{{data.battery}}},'Washroom 2 (Sanitation) Temp/Humid Sensor','{{{flow.inalarm}}}')","outField":"payload","returnType":"0","throwErrors":"0","x":782.9999847412109,"y":529.0000152587891,"wires":[[]]},{"id":"ab6ee7d5.02abb","type":"delay","z":"e1f6a792.4ccff","name":"1 msg / 30 minutes","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1601,"y":889,"wires":[["3aa52487.e26334"]]},{"id":"2ad09763.ded33","type":"ncd-gateway-config","z":"","name":"10.0.1.185","comm_type":"tcp","ip_address":"10.0.1.185","tcp_port":"2101","port":"","baudRate":"115200","pan_id":"7FFF","rssi":false},{"id":"913d8cd6.91de98","type":"ui_group","z":"","name":"Temperature","tab":"2b781833.48d438","order":2,"disp":false,"width":"5","collapse":false},{"id":"26dc1ec3.4c88da","type":"ui_group","z":"","name":"Humidity","tab":"2b781833.48d438","order":3,"disp":false,"width":"5","collapse":false},{"id":"2b781833.48d438","type":"ui_tab","z":"","name":"Room 27 - Washroom 2","icon":"dashboard","order":22,"disabled":false,"hidden":false}]

Does the modem you’re connecting to have a static IP address?

Connection refused triggers when a program can’t connect over TCP. Generally due to a change in IP address, an inelegant closing of the original socket when no timeout is set, or something else currently has the socket open.

The modem does have a static IP addressed assigned.

Does a reboot of the modem allow the socket to connect?

Does any sensor data come through?

Reboot of the modem doesn’t appear to do anything. Sensor data is coming through just fine.

Also, I had node-red and node.js running on a windows app server before I moved it to Ubuntu and was having the same issue.

Interesting, can you check your configuration nodes and see if you have multiple instances of either an ncd-comm or ncd-gateway-config? If there are multiple config nodes trying to connect in the background it would spit out a message like this.

No multiple instances that I can find…

image

Interesting…I saw this error pop up after I did a redeploy on the flows…

27 Sep 11:08:05 - [error] [ncd-wireless-node:5507c638.0cefe8] TypeError: Cannot read property ‘gateway’ of null
27 Sep 11:08:05 - [error] [ncd-wireless-node:4102c727.54a068] TypeError: Cannot read property ‘gateway’ of null

Disregard the prior reply. I see that error is because I do not have two nodes set to the wireless-ethernet modem

I believe that’s generally triggered by a misconfigured node.

Well, it sounds like it could be a code issue at this point if everything is working fine, I’ll set up a test. I don’t have a Linux box, but I’ve got a Mac so it should treat the connections about the same.

It might take a while depending on if i can track down an Ethernet Modem.

Jacob,

So with node-red running I unplugged the power from the ethernet modem and plugged it back in. The error message stopped spamming in the terminal and things seemed to function fine in node-red. I then did a redeploy of the flows and the error didn’t show up again. I then restarted node-red from the terminal and the error popped back up and terminal was getting spammed again.

I can duplicate this issue each time.

Thanks for the additional information. Definitely sounds like a code issue. I’ll take a look today, but it might take until early next week to get fixed depending on the scope of the issue.

Sounds good. Thanks for the help.

Unfortunately I cannot reproduce the issue.

The only way I can trigger the ECONNREFUSED error is to open the socket to the modem in another program.

You stated you had Node-Red running on another server, could you make sure this server is down?

Also add a debug into your flow and make sure that the data is coming through specific flows.