# S7-1200 read variable

**URL:** <https://discourse.nodered.org/t/s7-1200-read-variable/16183>\
**Category:** General\
**Created:** [2 October 2019 07:36 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183 "2019-10-02T07:36:50Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 07:36 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/1 "2019-10-02T07:36:50Z")

</div>

Hello,  
Have started for my first project with node red:  
System: CentOS 7  
Nodejs: 2:10.16.3  
Node Red: v1.0.0  
S7-1200 CPU1214C, Firmware 4.1

Have configured S7In from node-red-contrib-s7 and connected to debug in Flow.  
Node Parameter: Cycle: 10000 ms, Timeout: 5000 ms  
Get sometimes Timeout's:

"Keine Antwort, Neustart der Kommunikation" = "Timeout, restart Communication"

2.10.2019, 09:19:48node: e768e368.f8cd28](192.168.130.172:1880/#)msg : string[41]

"Keine Antwort, Neustart der Kommunikation"

2.10.2019, 09:19:53node: 9c3247.85f75db8](192.168.130.172:1880/#)msg.payload : Object

{ T1\_Abgabe: 22.299999237060547 }

2.10.2019, 09:20:00node: e768e368.f8cd28](192.168.130.172:1880/#)msg : string[41]

"Keine Antwort, Neustart der Kommunikation"

2.10.2019, 09:20:03node: 9c3247.85f75db8](192.168.130.172:1880/#)msg.payload : Object

{ T1\_Abgabe: 22.399999618530273 }

2.10.2019, 09:20:12node: e768e368.f8cd28](192.168.130.172:1880/#)msg : string[41]

"Keine Antwort, Neustart der Kommunikation"

2.10.2019, 09:20:14node: 9c3247.85f75db8](192.168.130.172:1880/#)msg.payload : Object

{ T1\_Abgabe: 22.5 }

2.10.2019, 09:20:24node: 9c3247.85f75db8](192.168.130.172:1880/#)msg.payload : Object

{ T1\_Abgabe: 22.5 }

2.10.2019, 09:20:24node: e768e368.f8cd28](192.168.130.172:1880/#)

ICMP Ping from Node Red host to S7:

64 bytes from 192.168.130.23: icmp\_seq=1 ttl=30 time=0.822 ms  
64 bytes from 192.168.130.23: icmp\_seq=2 ttl=30 time=0.900 ms  
64 bytes from 192.168.130.23: icmp\_seq=3 ttl=30 time=0.943 ms  
64 bytes from 192.168.130.23: icmp\_seq=4 ttl=30 time=0.879 ms  
64 bytes from 192.168.130.23: icmp\_seq=5 ttl=30 time=0.701 ms  
64 bytes from 192.168.130.23: icmp\_seq=6 ttl=30 time=0.656 ms  
64 bytes from 192.168.130.23: icmp\_seq=7 ttl=30 time=1.49 ms  
64 bytes from 192.168.130.23: icmp\_seq=8 ttl=30 time=0.932 ms  
64 bytes from 192.168.130.23: icmp\_seq=9 ttl=30 time=0.806 ms

Has somebody any useful hints?

Thanks and all the best,  
Frank

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [2 October 2019 07:42 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/2 "2019-10-02T07:42:58Z")

</div>

Have you read the "Notes on S7-1200/1500" of the [s7 node](https://flows.nodered.org/node/node-red-contrib-s7)? Maybe some configuration issue...🤔

I haven't tried the s7 node on 1200/1500 PLCs because we implemented our own TCP-based protocol for communication.

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 09:03 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/3 "2019-10-02T09:03:12Z")

</div>

Yes, "Optimized block access" is disabled for the DB.  
Permit access with PUT/GET is enabled.

I still getting values, read from the DB but also a lot of timeouts.

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 09:16 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/4 "2019-10-02T09:16:42Z")

</div>

Okay, I found out, the debug error comes not from the S7.

2.10.2019, 11:08:40[node: e768e368.f8cd28](http://192.168.130.172:1880/#)  
msg : string[41]  
"Keine Antwort, Neustart der Kommunikation"

In debug window, if I select current flow, the error of the node is not visible.  
If I select ALL NODES the error comes back. I have only one flow. How can I find out, what **node: e768e368.f8cd28** is?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 October 2019 09:21 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/5 "2019-10-02T09:21:50Z")

</div>

Have you tried clicking on the number? It should take you to that node (provided it isn’t in a subflow)

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 09:43 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/6 "2019-10-02T09:43:01Z")

</div>

If I filter for the node e768e368.f8cd28 I get no result, also by clicking on the node id

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f7b54d4943a44e707e5de4d97a0d263331c33374.png)

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [2 October 2019 09:53 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/7 "2019-10-02T09:53:43Z")

</div>

Could be the config node (s7-endpoint).

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 09:55 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/8 "2019-10-02T09:55:00Z")

</div>

I have exported the flow, in notepade I find the node ID. But I can't as a new user upload the file. So it's placed here:

```auto
[{"id":"6c23acd6.00a0c4","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e768e368.f8cd28","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.130.23","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"10000","timeout":"5000","verbose":"default","name":"","vartable":[{"addr":"DB26,REAL0","name":"T1_Abgabe"}]},{"id":"742b85b7.f0debc","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false},{"id":"6e60af29.6fcd2","type":"ui_group","z":"","name":"Kühlwasser","tab":"742b85b7.f0debc","disp":false,"width":"6","collapse":false},{"id":"78255b7b.2b4f64","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#aeae00","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#aeae00","edited":true},"page-titlebar-backgroundColor":{"value":"#aeae00","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#fafa00","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#aeae00","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Celebrate Records","hideToolbar":"false","allowSwipe":"false","lockMenu":"true","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"32d0288f.c95fb","type":"s7 in","z":"6c23acd6.00a0c4","endpoint":"e768e368.f8cd28","mode":"all","variable":"","diff":false,"name":"","x":154.5,"y":66,"wires":[["4f6166e7.0f94d8"]]},{"id":"be3bcecc.8a7f8","type":"ui_gauge","z":"6c23acd6.00a0c4","name":"","group":"6e60af29.6fcd2","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"","format":"{{msg.payload | number:1}}°C","min":"10","max":"40","colors":["#ca0000","#00ca00","#ca0000"],"seg1":"20","seg2":"23","x":631.5,"y":169,"wires":[]},{"id":"4f6166e7.0f94d8","type":"split","z":"6c23acd6.00a0c4","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":394.5,"y":172,"wires":[["be3bcecc.8a7f8","e55ece13.850f38"]]},{"id":"e55ece13.850f38","type":"ui_chart","z":"6c23acd6.00a0c4","name":"","group":"6e60af29.6fcd2","order":1,"width":0,"height":0,"label":"Kühlwasser Abgabe","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"waiting for data ...","dot":false,"ymin":"19","ymax":"25","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":688.5,"y":212,"wires":[[]]}]

```

It comes from the endpoint S7: "id":"e768e368.f8cd28","type":"s7 endpoint",

Do I have forgot something to configure for this endpoint?

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [2 October 2019 09:58 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/9 "2019-10-02T09:58:28Z")

</div>

Please format your shared flows properly.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [2 October 2019 10:27 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/10 "2019-10-02T10:27:27Z")

</div>

The message "Keine Antwort, Neustart der Kommunikation" indicates that the config node re-establishes the PLC connection due to timeouts.

I don't know which options the s7 node provides, but is there a configurable timeout that may be too short?

Another point could be the PLC cycle time... maybe it is too busy?

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [2 October 2019 11:34 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/11 "2019-10-02T11:34:16Z")

</div>

The PLC has a stable cycle time of 2 ms, maximum 5 ms.

I have add a DB (not optimized), in my Main OB1 I do move a value into the DB from which I read in Node red. The timout in S7 Node inside Node Red is set to 10000ms - I think long enougth.

The Profinet Options have some Parameters:  
Keep-Alive-Connection monitoring, set by default: 30s  
Webserver in PLC is disabled.

Please take a look into the following debug log, I have added as debug of the data I've get from the PLC:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/009d2422680123014109d32a70fcec3293d89104.png)

The error seems to be a false positive, because data was transmitted, take a look to the timestamps.

S7 endpoint cycle time is set to 10000ms but the debug shows data every 1000 ms.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c6357d169c47c4f797cf7310b40d9e440bc1cda4.png)

I think, the S7 PLC will polled every 10000ms?

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [7 October 2019 04:53 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/12 "2019-10-07T04:53:15Z")

</div>

The data is in fact being received every 10 seconds.

I have no other clue what is going on here, _could_ be a problem with the S7-1200/1500 protocol.  
I think you should open an issue at Github and/or contact the node's author.

> **[netsmarttech/node-red-contrib-s7](https://github.com/netsmarttech/node-red-contrib-s7)**
>
> A Node-RED node to interact with Siemens S7 PLCs. Contribute to netsmarttech/node-red-contrib-s7 development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [7 October 2019 04:55 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/13 "2019-10-07T04:55:40Z")

</div>

The problem is solved. After update to json-c-0.11-4.el7\_0.x86\_64, the error was gone.  
Thanks for all help and useful hints.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [7 October 2019 06:12 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/14 "2019-10-07T06:12:42Z")

</div>

Just out of curiosity... where is this library being used?

---

<div class="post-metadata">

**Author:** ![digidax](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@digidax](https://discourse.nodered.org/u/digidax)\
**Post date:** [7 October 2019 06:53 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/15 "2019-10-07T06:53:31Z")

</div>

The only thing I found, it was installed as dept:

Dep-Install json-c-0.11-4.el7\_0.x86\_64 @base  
Updated libfastjson-0.99.4-2.el7.x86\_64 ?

It was was a fresh CentOS 7 container, only node red was installed. So I think, it was installed as a dept of the node red installation. After performing a system wide update, the error was never seen in the debug log. So I think, it comes from the jason Lib maybe.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [7 October 2019 06:55 UTC](https://discourse.nodered.org/t/s7-1200-read-variable/16183/16 "2019-10-07T06:55:49Z")

</div>

I can't imagine how that could be related to the PLC connection. 🤔

Maybe the restart fixed it.
