Integrate Siemens Logo (plclogo) in OpenHAB 2

Tags: #<Tag:0x00007fe04ec665e8> #<Tag:0x00007fe04ec664a8> #<Tag:0x00007fe04ec66368>

(Mcullmann) #183

Hi everybody,

I am really glad, this topic is growing that much and so many people are interested in it.

I was able to use the rule almost at the beginning of this topic, to use switches as a working virtual switch including feedback from a real switch, with the newest version. For all beginners, I do not want to keep it by myself:


// FF_Dining_Light
Switch          FF_Dining_Light            "Licht"               <light>            (FF_Dining, gLight)               {channel=""}

Switch ReadOutput01 		{channel="plclogo:digital:Logo1:Outputs:Q1"}
Switch invisibleSwitch01 	{channel="plclogo:pulse:Logo1:VB200_2:state"}


Bridge plclogo:device:Logo1 [ address="", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
	// FF_Dining_Light
	Thing pulse    VB200_2 [ block="VB200.2", observe="Q1", pulse=500 ] 


rule "Switch Light through Logo_1"
    Item ReadOutput01 changed or                         // light changed external
    Item FF_Dining_Light received command                  // light changed internal
    if(receivedCommand==ON ||receivedCommand==OFF) {     // ensure there was a received command, so second item triggered rule
        if (ReadOutput01.state != receivedCommand) {     // only if state changed
            invisibleSwitch01.sendCommand(ON)                 // send an ON
            invisibleSwitch01.sendCommand(OFF)                // send an OFF
    else {                                                 // no trigger from proxy switch, so state changed externally
        if (ReadOutput01.state != FF_Dining_Light.state) { // if state changed really
            FF_Dining_Light.postUpdate(ReadOutput01.state) // update the state without triggering the rule


sitemap our_home label="Our Home" {
	Frame label="Allgemein" icon="attic" {
               Text label="Licht" icon="light" {
                      Default item=FF_Dining_Light label="Esszimmer"

But I also have a question, I am not that into the rules stuff of openhab, I was just able to modify this on at the top of this topic for my needs. There were already discussions about the rollershutters, what is possible and what not. For now, I am confused and not sure about it.
I have two virtual address, one for rollershutter up (VB100.0) and one for down (VB100.1). If necessary I could do a third for stop.

Is there any way today, to realize a rollershutter icon with that addresses, may also with a rule if a native way is not possible yet?

Any help is really appreciated.

(Mcullmann) #184

Hi to everybody,

I did it by myself and want so share the result with you:


Rollershutter   FF_LivingRoom_Shutter      "Rolladen"        <rollershutter>    (FF_LivingRoom, gShutter)		  {channel=""}

Switch ReadOutputUp01 			{channel="plclogo:digital:Logo1:Outputs:Q11"}
Switch invisibleSwitchUp01 		{channel="plclogo:pulse:Logo1:VB100_0:state"}
Switch ReadOutputDown01			{channel="plclogo:digital:Logo1:Outputs:Q12"}
Switch invisibleSwitchDown01	{channel="plclogo:pulse:Logo1:VB100_1:state"}
import org.openhab.core.items.*
import org.openhab.core.library.items.*
import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*

import org.joda.time.*
import java.lang.*
import java.util.*

val org.eclipse.xtext.xbase.lib.Functions$Function4 LogoRolloLogic = [
  org.openhab.core.types.Command Command, SwitchItem Up, SwitchItem Down, org.openhab.core.types.Command Direction |
    case UP: {
      createTimer(now.plusMillis(100), [|Up.sendCommand(OFF)])
    case DOWN: {
      createTimer(now.plusMillis(100), [|Down.sendCommand(OFF)])
    case STOP: {
      if(Direction == UP) {
        createTimer(now.plusMillis(100), [|Up.sendCommand(OFF)])
      } else if (Direction == DOWN) {
        createTimer(now.plusMillis(100), [|Down.sendCommand(OFF)])
      } else if (Direction != STOP) {
        logDebug("LogoRolloLogic", "Direction " + Direction + " is not supported.")

rule "rollershutter01"
  Item FF_LivingRoom_Shutter received command
  var dir = STOP
  if(ReadOutputDown01.state == ON) { dir = UP }
  else if (ReadOutputUp01.state == ON) { dir = DOWN }
  LogoRolloLogic.apply(receivedCommand, invisibleSwitchDown01, invisibleSwitchUp01, dir)


Bridge plclogo:device:Logo1 [ address="", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
	// VB1XX.X = rollershutter
	// VB1XX.0 = up
	// VB1XX.1 = down
	// Allgemeine Initialisierung
	Thing digital  Inputs  [ kind="I" ]
	Thing digital  Outputs [ kind="Q" ]
	// FF_LivingRoom_Shutter
	Thing pulse    VB100_0 [ block="VB100.0", observe="Q11", pulse=500 ]
	Thing pulse    VB100_1 [ block="VB100.1", observe="Q12", pulse=500 ] 


sitemap our_home label="Our Home" {
	Frame label="Allgemein" icon="attic"{
        Text label="Rolladen" icon="rollershutter" {
            Default item=FF_LivingRoom_Shutter label="Wohnzimmer Tür"


Hope this helps the other guys to realize a roller shutter, even if percent and stop is not implemented in that solution. Any improvement proposal are appreciated .

(Udo Hartmann) #185

Please be aware that none of your actual imports are necessary in openHAB2 anymore.
Importing a bunch of functions (with *) is deprecated and does not work - there should be a warning about this in openhab.log.

(Andre Kaiser) #186


i am a Beginner in Openhab. Could someone post an
functioning Config?
I can not do it

(Mcullmann) #187

@ Udo: Thank you for that information, I will delete the imports.

@ dreamer: I actually did just two posts before, one is for light switches and one for roller shutter. You just need to change your IP, blockname and output name.

(tv-arnd) #188

@ falkena Great job, my 1st steps with plclogo binding works out of the box.
Some feedback regarding the documentation:

In the logo.things example files the TSAP values are shown as 0x3100 / 0x2000. But in the table at the beginning of the documentation, the values are defined as 0x0300 or 0x0200. This might be a bit confusing. Hope that helps improving the documentation.


(Alexander Falkenstern) #189

Hi @tv-arnd,

fixed it. Thanks.

(Alexander Falkenstern) #190

Hello everybody,

I’ve pushed binding update to my binary repository some days ago: @BlackAlpha found small bug with marker blocks on Logo7. Thanks for testing :slight_smile:

BTW: Pull-request is still open :frowning:

Kind regards,


(tv-arnd) #191

Hi everybody,
I am still reading / exploring this as a beginner…hoping to discover common pitfalls.
I cannot see the status (nor status updates) in PaperUI/Control for Logo-inputs. It works for Logo-outputs. Status updates work for inputs/outputs in BasicUI/Sitemap (re-start of OpenHAB helps after re-config, also working with several browsers).
Do you see any status (updates) for inputs in PaperUI?
Here my items (I played a lot with [%s] ):

Contact Logo7_I1        "I1 status is [MAP(]" { channel="plclogo:digital:Logo7:Inputs:I1" }
Contact Logo7_I2        "I2 [%s]" <light>   { channel="plclogo:digital:Logo7:Inputs:I2" }
Contact Logo7_I3_Kueche "I3 Status Fenster [MAP(]"    <door> { channel="plclogo:digital:Logo7:Inputs:I3" } 


(Alexander Falkenstern) #192

Hello @tv-arnd,

this was my observation too: PaperUi will not show state for Contact items. More over: sometimes PaperUi failes to update the state for Switch items properly. I observed it with pulse things with 100ms pulse length. Nevertheless, the state is updated properly: log file has entries about item state change.

Kind regards,


(Joe) #193

i don’t know why my settings are not working.
openhab 2.4 and newest plclogo-2.3.0 installed

simple configuration of one logo with on Analog Thing (AI4)
the connection to the logo seems to work but not to the AI


and the log says:
2018-06-19 11:25:47.618 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from TCP Sending error.

i also tried with other logos and only one digital thing (Q1).

what should i do?

same effect wita01 described above

(Stefan) #195

Hi there
I have exactly the same issue (warning, non functioning) here. strugguling with that since February. I was hoping the actual version of the binding would help to make it working but no sucess yet. ;(

For me, the fault message appears once per second in the log for ten times, before it stops and restarts after another 5 seconds or so.
ANY idea, please?!

PS: OH2 is running a virtual machine (VMWare, Ubuntu Server 18.x)

for some reason, it seams that 2 jobs are created at the same time on a restart:

2018-06-19 20:07:03.525 [INFO ] [ing.plclogo.handler.PLCBridgeHandler] - Creating new reader job for with interval 100 ms.
2018-06-19 20:07:03.536 [INFO ] [ing.plclogo.handler.PLCBridgeHandler] - Creating new RTC job for with interval 500 ms.

(Stefan) #196

I’d like to share my config now, and hope that anyone can tell me what I’m doing wrong :slight_smile:


(the idea of timer B005 and B044 is, to avoid any misbehavior in case V2.0 or V2.4 remains on indefinitely for some reason; works well in simulation)


Binding is running:


disregard items in section “virtual switch”, except the first two lines as they’re not existing anymore


(will not post the rule for now since I suspect the problem is in communication)

screenshot shows a formerly used config with more than just two puls-things. Disregard the 6 digital pulse in/outputs in the bottom as they don’t exist anymore in the actual config

(note that any pulse remains on, once it was activated, clicking it on that page causes two entries in events log: "changed from ON to OFF ; changed from OFF to ON)

and finally the openhab log:

please help! Thank you very much in advance!

(Alexander Falkenstern) #197

Hello @everybody,

after a long time, PR was reviewed and some modifications was need. Additionally, i build the binding against 2.4.0 snapshot. Download it here, please. Is it possible to get feedback, if it still work? Thanks :slight_smile:

@novoplan: As far as i see, you are using old configuration style. It will not work with current binding version.
You can access analog block now via

  Thing analog aInputs  [ kind="AI" ]
  Thing analog aOutputs [ kind="AQ" ]

Inputs/Outputs can be found then in Channels:

Please, take a look into documentation for more details. The warning in a log file simply says, that binding was unable to get new states from Logo and the reason why.

@wita01: VMWare can be a reason for your network issues, since communication runs via virtual network adapter and not physical one. May be this helps… That’s right, binding creates two reader threads: One thread to monitor data state changes and another to monitor RTC (Real Time Clock). The reason is simple: Logo updates RTC once a second. And i’ll have the value as accurate as possible, even data update thread is configured to fetch changes once a minute. Please, forget PaperUI, if you will monitor state changes properly. PaperUI simply fail to get changes. Sometimes it helps to reload browser page. Additionally, especially pulse things tends not to update properly, if modified via PaperUI. My test system ends sometimes in a kind of endless loop: Pulse switch goes pemanently ON/OFF. Restart openhab or Logo! will help only :frowning:

Kind regards,


(Stefan) #198

@falkena: Thanks for your reply and explanations. I’m almost sure that VMWare is not the origing of the issue, because I was playing around with a former version of your Binding on a raspberry PI. This was done in February or so, with exactly the same Log entries. Additionally do you think that no communication would be the result in that case? Poor network performence might be an explanation for unstable communication rather than no communication, in my opinion?
My ethernet network has max. 30 devices online, including all access points, mobile phones and so on. Not much traffic, however there are quite a few nodes to be passed: Notebook-> EthernetSwitch-> Router(Switch)-> EthernetSwitch-> PowerLineAdaptor-> 230V-> PowerLineAdaptor-> Logo.
But LogoSoftComfort, for example, works perfectly fine (OH2 stopped of course), and also Ping returns reasonable times with no package loss. Both from a Virtualized Windows machine running in parallel to OH2 (not from the pysical host!).
Anyway I will retry with just one switch in between, and/or from a raspberry.

Thanks for this advice - what a pitty! Will there be along term solution? I do never want my outdoor lights in an endless ON and OFF loop!
But for monitoring I also used the “events.log”, as well as my eyes (no light was going on) so definitely no communication- neither to- nor from the Logo.

I’m really looking forward to having your great piece of work running in my environment :slight_smile:
Thank you!

(Alexander Falkenstern) #199

Hi @wita01,

as far i see, you are able to communicate with Logo. But it seems to be very unstable: You get nearly every 3’d second timeout. After any timeout, new connection must be opened. This is a warning you see. May be it’s a good idea to reduce Log-Level from WARN to INFO or DEBUG. I wouldn’t trust LogoSoftComfort: It may have the same behaviour and you simply do not see it… Please, try follow: “Hack” a small FBD as shown here. Then “hack” two memory and digital output things:

// things
Thing  digital Outputs [ kind="Q" ]
Thing  memory  VB0_1   [ block="VB0.1" ]
Thing  memory  VB0_2   [ block="VB0.2" ]

And create items connected to things above on properly channels. Then start openhab and online simulation in LogoSoftComfort! same time on same Logo. You should see NI state changes in online simulation, if you modify switches in openhab and openhab should reflect Q1 changes. Was it successfull? What time is reported by ping?

My follow setup work fine with 100ms - polling

Production system:

                                                                                                | --> Logo1

RasPi3 --> Cable --> Router --> Cable --> Switch --> Cable --> -|
| --> Logo2
Ping response: 0.5-5ms for both Logos.

Test system:
RasPi2 --> Wireless --> Router --> Cable --> Cable --> Logo
Ping response: 3-16ms

Kind regards,


(Joe) #200

thanks a lot. now i can see the actual state of my items.
but why i get those warnings in the log?

2018-06-26 13:17:26.032 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from TCP Sending error.

(Alexander Falkenstern) #201

Hi @novoplan,
normally due to network connection. It seems, i must reduce log level from WARN to INFO :slight_smile:

Kind regards,


(Joe) #202

does the binding need an internet connection? i’m wondering.
after enabling my filter rule to disconnect the pi from the internet, the binding responses a network error.
everythings works fine after disabling the filter.
ping to the logos with enabled filter works fine.

(Alexander Falkenstern) #203

@novoplan: No. Internet connection isn’t need. But at least port 102 must be open:

Kind regards,