OpenHAB and S7-300 from Siemens

The binding works with openhab2.

Has anyone tried to run it with openhab 1.8.3 and can help me ?

Hello @b-tronic,
simatic binding was written to OH1 natively. So it is able to run under openhab1.8.3. Under OH2 it runs in compatibility mode.

Hello,

I would be eager to test this bundle as well. I am so glad this gap is being filled. Thanks very much for this.

My complete home automation and alarm system is based on 2 Siemens S7-200 PLCs. I used the bundle referred to above in my OH B5 installation (v1.1.2). Unfortunately I do not see a lot of loading of the bundle neither an attempt to make a connection or read something from the PLC. Could you please help me further?

item file
Number S71515MB0 “MB0 [%d]” { simatic=“plc417:MB0:byte” }

Service file
refresh=2000
plc417=192.168.0.10:0.2

Logs:

2017-01-06 02:16:34.987 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Starting destruction process
2017-01-06 02:16:34.987 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Not an extended bundle or destruction of extension already finished
2017-01-06 02:16:34.987 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Starting destruction process
2017-01-06 02:16:34.987 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Not an extended bundle or destruction of extension already finished
2017-01-06 02:16:35.019 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Starting destruction process
2017-01-06 02:16:35.019 [DEBUG] [ell.impl.action.osgi.CommandExtender] - org.openhab.binding.simatic (209): Not an extended bundle or destruction of extension already finished
2017-01-06 02:16:35.034 [DEBUG] [mpl.info.InfoBundleTrackerCustomizer] - Ignore incorrect info null provided by bundle org.openhab.binding.simatic
2017-01-06 02:16:35.034 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - Bundle Considered for SPI providers: org.openhab.binding.simatic
2017-01-06 02:16:35.034 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - No ‘SPI-Provider’ Manifest header. Skipping bundle: org.openhab.binding.simatic

Hi be04062,

if you realy have a cpu 417 you should use slot 3 insted 2. Maybe that helps.

regards Thomas

Hi Thomas,

Its an S7 200 CPU and from my other development I know its located fixed at slot 0 rack 2. But I have read the cpus for 300 and 400 series can be located in other positions.

However, I would expect somewhere in the logs a connection failure to the CPU which I do not find therefor I think the bundle does not even try to connect.

Hello @be04062,

I don’t know why there is no connect try in log. That’s strange. However communication through CP243 (S7-200) is not supported / implemented. That’s because I don’t have PLC for tests. But if you are interested to be a tester with your hardware, I can implemented it. It will not be much difficult.

Awesome addon - How does the addon communicate with the PLC? Does it use PUT/GET or do i have to make an S7 connection or?

Hello @Rasmus7700,

it uses S7 communication (with libnodave library help). You only have to configure target PLC in this addon configuration file. Nothing has to be done on the target PLC.

Why isn’t the binding on the official site and can be installed from the Paper UI?

This binding is for openHAB 1.x but it works in openHAB2 under compatibility mode too. How to use OH1.x binding under OH2 can be find at http://docs.openhab.org/developers/development/compatibilitylayer.html

For OH2 there is another binding right now in pull request stage (https://github.com/openhab/openhab2-addons/pull/1606). So I thing there is no reason to convert this binding to pure OH2 binding. N

Hello vita

I have a setup with a S7 226 CPU and Cp243-IT Communication Processer. I can communicate with libnodave with the CPU. Option “-2” in libnodave is needed to communicate with CP243

But no chance in Openhab.
Error Message:

2018-07-16 13:58:01.322 [INFO ] [imatic.internal.SimaticGenericDevice] - isoTCP:192.168.8.240: Trying to reconnect

2018-07-16 13:58:03.582 [ERROR] [.binding.simatic.internal.SimaticTCP] - isoTCP:192.168.8.240 - cannot connect to PLC due: Broken pipe (Write failed)
################################### Simatic Binding ######################################
#
# plc - define tagret PLC by IP address, cpu rack and slot. Definition look IP:rack.slot (ex.: 192.168.254.36:0.2). 
# Above that communication type can be optionally specify at the end separate by semicolon.
# Supported communication types : PG, OP and S7.
# It is possible defined more PLCs ex. plc, plc1, plc315,... 
# 
# refresh - check for new data interval - default 1000ms   
#
simatic:refresh=2000      
simatic:plc=192.168.8.240:0.2
#simatic:plc1212=192.168.254.99:0.1:OP
#simatic:plc1515=192.168.254.127:0.1
#simatic:plc417=192.168.254.128:0.3

Thank you for your investigation

As I wrote in post above, S7-200 is not supported in this binding.

---------- Původní e-mail ----------

Od: Hans Werner Samonik bot@community.openhab.org

Komu: vita.tucek@seznam.cz

Předmět: [openHAB] [Setup, Configuration and Use/Beginners] OpenHAB and S7-300
from Siemens

Did a quick and dirty change in org.openhab.binding.simatic

Changed Line 161 in SimaticTCP.java to:
dc = new TCP243Connection(di, rack, slot);

Communication to S7-200 is working stable over CP243 since almost one month now.

Continuing the discussion from OpenHAB and S7-300 from Siemens:

Hi vita,

is it possible to enlarge the buffer of the “readBytes” an the “writeBytes”?
I’ve got the following error:

2019-01-20 19:48:23.603 [ERROR] [.binding.simatic.internal.SimaticTCP] - isoTCP:192.168.2.50 - Read data area error (Area=I8-I26, Return code=0xffffff7e, Error=Buffer size insufficient while readBytes)

I’ve got a lot of variables in the simatic binding an it runs stable, but if i add one fother variable the portstate change from 1 to 6 an the error message comes in a loop of 3 seconds. If I clear a variable, the binding runs again stable.

I hope you can find a oppertunity to solve my problem. Thanks!

HI,
are you sure that you use latest binding version ? If so please create new issue in binding repository and attach there your binding configuration also. I will look on it.

Hi vita,

is it possible to add the datatype TOD (time of day)? It would be easier to change the time of timeclocks.

I thank you for your effort.

Hi,

Is not TOD just number od milliseconds stored in doubleword? So to store time you can easily use doubleword address (MD or DBD)

    1. 2019, 12:01, xxx via openHAB Community bot@community.openhab.org napsal/a:

Hi vita,

no it is a Value with houre, minute and second. I’ve took a screenshot for you:

I tried some different item properties but it shows all times a wrong value.

Here is one of the attempt:
Number EinschaltZeitpunkt “Value[%1$td.%1$tm.%1$ts]” { simatic=“plc:DB42.DBD0:word:IO” }

and my log (i changend from float to word):
2019-03-02 19:13:43.013 [vent.ItemStateChangedEvent] - EinschaltZeitpunkt changed from 0.000000000000000000000000000000000005951778149940272 to 83700000

Number from DBD0 is 83700000 right? That is:

83700000 ms

83700 s

1395 min

23h 15min 00s

So that is same number as that one from TIA

Best

    1. 2019, 19:31, xxx via openHAB Community bot@community.openhab.org napsal/a:

Hi Vita,

thank you for the statement.