# Node-red on iot2050 not working

**URL:** <https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476>\
**Category:** General\
**Created:** [10 January 2023 15:23 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476 "2023-01-10T15:23:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vu.vo\_dtt.tt.18](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vu.vo\_dtt.tt.18](https://discourse.nodered.org/u/vu.vo_dtt.tt.18)\
**Post date:** [10 January 2023 15:23 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/1 "2023-01-10T15:23:57Z")

</div>

Hi,  
I am working on a student project involve using iot2050 and Node-red to poll data.  
So I connected my laptop to the iot2050 with an ethernet cable.I try to poll some number from a slave simulation program ( Modbus Slave) on my lap with a simple flow but it did not work.  
My flow

```auto
[{"id":"4b33b8e7.cd2418","type":"tab","label":"TEST 2","disabled":false,"info":""},{"id":"761d864e.aa0488","type":"inject","z":"4b33b8e7.cd2418","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":180,"wires":[["ec566e06.f820d"]]},{"id":"2cc1b935.4b8ff6","type":"modbus-flex-getter","z":"4b33b8e7.cd2418","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"659784ca.45dbcc","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":450,"y":180,"wires":[["c3e59b32.af2cb8"],["2d01a806.3793f8"]]},{"id":"c3e59b32.af2cb8","type":"modbus-response","z":"4b33b8e7.cd2418","name":"","registerShowMax":20,"x":690,"y":160,"wires":[]},{"id":"ec566e06.f820d","type":"function","z":"4b33b8e7.cd2418","name":"function 1","func":"msg.payload = { \n 'fc': 3, \n 'unitid': 1, \n 'address': 0, \n 'quantity': 10 } \nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":280,"y":240,"wires":[["2cc1b935.4b8ff6"]]},{"id":"2d01a806.3793f8","type":"debug","z":"4b33b8e7.cd2418","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":220,"wires":[]},{"id":"659784ca.45dbcc","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.200.5","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

```

I set my lap ip address to 192.168.200.5 and set Modbus Slave to listen to server 192.168.200.5 port 502.  
I am very new to iot and Node-red in general so I do not know if the problem is node-red, hardware setup or outside factor.  
If it is inappropriate to ask such problem here then I apologize.  
Any help is appreciated.

Edit 1: I turned on error msg on the modbus-flex-getter node and in the Debug window, it said: "Error: Client Not Ready To Read At State init". Hope it provides some infomation.

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [10 January 2023 17:30 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/2 "2023-01-10T17:30:41Z")

</div>

First thing would be to setup different IP addresses. Right now your laptops network card IP is the same as IOT2050. So change one of those.

I've never worked IOT2050, but from this video [Siemens SIMATIC IOT2050 First Look - Industrial Internet of Things Gateway powered by Debian Linux - YouTube](https://www.youtube.com/watch?v=gEe8FVaR2Zo) I see that it is very similar to IOT2040. After making changes you should try and ping your Modbus server to see if connection is established.

There are tons of examples in nodered forum and also in siemens forum if you like

---

<div class="post-metadata">

**Author:** ![vu.vo\_dtt.tt.18](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vu.vo\_dtt.tt.18](https://discourse.nodered.org/u/vu.vo_dtt.tt.18)\
**Post date:** [10 January 2023 17:51 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/3 "2023-01-10T17:51:11Z")

</div>

Thank you for the reply. But the iot2050 ip address is 192.168.200.1 at the moment, and I was able to ping it with no problem.  
The Modbus-flex-getter gave error message "Error: Client Not Ready To Read At State init", Do you have any ideas why that error occurs?

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [10 January 2023 18:24 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/4 "2023-01-10T18:24:03Z")

</div>

Honestly never seen it, but here are the issue raised with similar problem

> <https://github.com/BiancoRoyal/node-red-contrib-modbus/issues/211>
>
> \*\*Problem\*\*
> - (x) bug report 
> 
> \*\*My setup is like\*\*
> Separate flow which pol…ls data via ModbusFlexRead every 5 second, I perform 6 poll on the equipment to read various parameters of it. the idea is that when you finish testing on 1 equipment, this same configuration is done with 130 equipment, would it be possible?
>  
> \*\*Current behavior\*\*
> After six or eight hours mobus-tcp-server begins to have port not open issue,
> Error: Client Not Ready To Read At State init, after changing the acquisition times and restarting the flow, it starts working again.
> 
> \*\*\* Device :\*\*
> - (x) Linux: vUbuntu
> 
> \*\*And here is following log\*\*
> 
> {"message":"Error: Client Not Ready To Read At State init","source":{"id":"35195cd4.d005d4","type":"modbus-flex-getter","name":"Modbus Flexible Read","count":1},"stack":"Error: Client Not Ready To Read At State init\\n at Object.\<anonymous\> (/home/administrador/.node-red/node\_modules/node-red-contrib-modbus/modbus/maps/modbus-client.js:441:14)\\n at Object.emit (events.js:198:13)\\n at Object.emit (/usr/local/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:185:20)\\n at Object.\_inputCallback (/home/administrador/.node-red/node\_modules/node-red-contrib-modbus/modbus/maps/modbus-flex-getter.js:146:21)\\n at Object.Node.\_emitInput (/usr/local/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:200:18)\\n at Immediate.\_onImmediate (/usr/local/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:179:33)\\n at runCallback (timers.js:705:18)\\n at tryOnImmediate (timers.js:676:5)\\n at processImmediate (timers.js:658:5)"}
> 
> \* Description of the connecting Modbus system:
>    
> - Name : Inverter SMA communicate Modbus TCP
> - Vendor : SMA
> - Link : https://www.sma.de/es/productos/inversor-fotovoltaico/sunny-highpower-peak3.html
>     
> \* \*\*node-red-contrib-modbus version:\*\* v5.3.13
> 
> \* \*\*Node:\*\*
> node --version= v 1.1.0
> 
> Thanks for your help beforehand

it seems that this issue is related to Modbus Flex Getter, why don't you use simple Modbus Read node?

---

<div class="post-metadata">

**Author:** ![vu.vo\_dtt.tt.18](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vu.vo\_dtt.tt.18](https://discourse.nodered.org/u/vu.vo_dtt.tt.18)\
**Post date:** [10 January 2023 19:01 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/5 "2023-01-10T19:01:22Z")

</div>

Thank you. I have read the issue that you mentioned, however mine never worked in the first place so I think the problem might be different.  
I used Modbus-read node as your suggestion, the same error happened. I was able to see the status of the node: Registered =\> Reconnecting after 2000ms =\> Initialized =\> Reconnecting after 2000ms then repeat; when I inject the node, the same error message happens. Is this behaviour normal?  
My flow:

```auto
[{"id":"16606710.e0a2e9","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ca63c4f8.9a3958","type":"modbus-response","z":"16606710.e0a2e9","name":"","registerShowMax":20,"x":570,"y":140,"wires":[]},{"id":"cbaa3344.253f5","type":"debug","z":"16606710.e0a2e9","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":200,"wires":[]},{"id":"5d50ee8b.8a6ba","type":"modbus-read","z":"16606710.e0a2e9","name":"","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"0","quantity":"10","rate":"1","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"7248280a.ff4248","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":230,"y":160,"wires":[["ca63c4f8.9a3958"],["cbaa3344.253f5"]]},{"id":"7248280a.ff4248","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.200.5","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"250","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

```

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [10 January 2023 19:13 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/6 "2023-01-10T19:13:19Z")

</div>

Are these your current settings?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7bf649676b18ee975238d51f00c7e947aff9129d.png)

This is an example from energy meter:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a30cb5d3a03ae817d98329e8e9361ee5fc0874aa.png)

You should check addresses (do you have address table?) and you should reduce polling rate to 1-10s range

---

<div class="post-metadata">

**Author:** ![vu.vo\_dtt.tt.18](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vu.vo\_dtt.tt.18](https://discourse.nodered.org/u/vu.vo_dtt.tt.18)\
**Post date:** [10 January 2023 19:34 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/7 "2023-01-10T19:34:30Z")

</div>

I am currently polling from a simulated slave using Modbus slave on my laptop so I expected the Modbus Response to be an array of 10 0s.  
I have changed the poll rate per your suggestion but the problem is not solved.

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [10 January 2023 19:42 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/8 "2023-01-10T19:42:00Z")

</div>

What simulation tool are you using?

Maybe please and follow this guide? [ModBus, Node-Red and MQTT -Video 1 - YouTube](https://www.youtube.com/watch?v=f6BhSprc9i4&t=164s)

---

<div class="post-metadata">

**Author:** ![vu.vo\_dtt.tt.18](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vu.vo\_dtt.tt.18](https://discourse.nodered.org/u/vu.vo_dtt.tt.18)\
**Post date:** [10 January 2023 20:02 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/9 "2023-01-10T20:02:05Z")

</div>

I was using [https://www.modbustools.com/modbus\_slave.html](https://www.modbustools.com/modbus_slave.html)  
I have watched the video you suggested, my original flow was after I followed the instruction in the video.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 March 2023 20:03 UTC](https://discourse.nodered.org/t/node-red-on-iot2050-not-working/73476/10 "2023-03-11T20:03:01Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
