Integrate Siemens Logo (plclogo) in OpenHAB 2

Hi @Petos,

found time to take a look into your log-files. It looks like binding is not loaded. Please try follow:

  1. Stop openhab
  2. Remove /var/lib/openhab2/cache/* and /var/lib/openhab2/tmp/* (openHAB 2.1 is out!)
  3. Remove any bindings from /usr/share/openhab2/addons/
  4. Start openhab and wait it’s up
  5. Stop openhab
  6. Copy/move your bindings to /usr/share/openhab2/addons/
  7. Start openhab
  8. Login to karaf console
  9. Check, if binding load and is active: bundle:list
  10. If not, try to install: bundle:install. Near information, you can get via help bundle:install

help bundle returns more help for available commands.

Kind reagards,

Alexander

Hi @falkena,
i made it exactly as you wrote. At first i add only plclogo binding snapshot v 2.2, but still not loading.

Second i tried snapshot v 2.1 with other bindings (camera and gauge widget).
plclogo still nothing



My addons:

Why?
BR
Petr

I think that something is wrong with the jar that you donwloaded (size is smaller than what is available online)
Maybe you grabbed the blob, not the raw entry

Use this link:

https://github.com/falkena/binaries/raw/master/org.openhab.binding.plclogo-2.2.0-SNAPSHOT.jar

Hi @Dim,
it works now!
Thank you for your advice!!
BR
Petr

1 Like

Hi everybody,

i just published new Version of the binding with new pulse thing. New version can be download here. Additionally a lot of things are happend inside due to PR - Review.

@BlackAlpha, @jens, @skazi, @Petos Is it possible to get feedback? :wink:

Kind regards,

Alexander

1 Like

Hi everybody,

I am glad there are so many others involved to this topic and there are now so many helpful informations.

I wanted to summarize this information into a “HowTo” and tried a totally new installation, but unfortunately, I don’t get it working again, so I am not able to do the “HowTo” :frowning:

What I did:
Pre Requirement is a running version of OpenHab2
cd /usr/share/openhab2/addons/
wget https://github.com/falkena/binaries/raw/master/org.openhab.binding.plclogo-2.2.0-SNAPSHOT.jar
Also I added a plc.cfg to etc/openhab2/services with the following configuration.


# plclogo:.host= IP address of the LOGO! PLC
Logo1.host=192.168.1.11
Logo2.host=192.168.1.12


# plclogo:.remoteTSAP= the TSAP (in hex) of the remote LOGO! PLC, as configured by LogoSoft Comfort. Common used value is 0x0200.
Logo1.remoteTSAP=0x0200
Logo2.remoteTSAP=0x0200


# plclogo::localTSAP= the TSAP (in hex) to be used by the local instance. Common used value is 0x0300.
Logo1.localTSAP=0x0100
Logo2.localTSAP=0x0100


# plclogo:refresh= polling interval in milliseconds to be used when querying the LOGO!. Default is 5000mS
refresh=1000
Logo1.model=0BA8
Logo2.model=0BA8

But I think this config file is not necessary anymore?

After that, I found the PLC Logo in the bindings and my two logos in the things.
So I changed the Local TSAP to 0x0100 and the remote TSAP to 0x0200 and set the LogoFamily to 0BA8.

Are this settings correct?

I don’t get the Logo Things online, what do I missing?

Hi @mcullmann,

there no need for plc.cfg. This file is need for the openhab1 version of binding. Please remove it. Then create logo.things file in things subdirectory:

Bridge plclogo:device:Logo1 [ address="192.168.1.11", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
{
}
Bridge plclogo:device:Logo2 [ address="192.168.1.12", family="0BA8", localTSAP="0x0200", remoteTSAP="0x0200", refresh=100 ]
{
}

Now comes “frustrating” part:
Inside of each bridge create things for each block you need. It can happen, that you need a lot of them…

Bridge plclogo:device:Logo1 [ address="192.168.1.11", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
{
  Thing digital Q1    [ block="Q1" ]
}
Bridge plclogo:device:Logo2 [ address="192.168.1.12", family="0BA8", localTSAP="0x0200", remoteTSAP="0x0200", refresh=100 ]
{
  Thing digital Q1    [ block="Q1" ]
}

Be sure to change localTSAP for 192.168.1.11 to 01.00 in LogoSoft Comfort.

More information about configuration can be found here.

Kind regards,

Alexander.

PS: Feel free to report bugs :slight_smile:

1 Like

Hi everybody,

just pushed new version here.

Change log:
Fix block name regular expressions by @skazi.

Kind regards,

Alexander.

1 Like

I found my mistake, openhab saved the IP address in this format 192_168_1_11, of course this did not work, :smiley:

Now I have another problem, :see_no_evil:

I really liked this solution for my switch, but it seems not to work anymore:

I updated it to this:
meine.items:

Switch ReadOutput01 		{channel="plclogo:digital:Logo1:Q9:state"}
Switch invisibleSwitch01 	{channel="plclogo:digital:Logo1:VB201_2:state"}
Switch ruleSwitch01 		"Wohnzimmer"   <light> ["Lighting"]

logo.rules:

rule "Switch Light through Logo_1"
when
    Item ReadOutput01 changed or                         // light changed external
    Item ruleSwitch01 received command                  // light changed internal
then
    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 != ruleSwitch01.state) { // if state changed really
            ruleSwitch01.postUpdate(ReadOutput01.state) // update the state without triggering the rule
        }
	}
end

logo.things:

Bridge plclogo:device:Logo1 [ address="192.168.1.11", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
{
  Thing digital VB200_2 [ block="VB200.2" ]
  Thing digital VB201_2 [ block="VB201.2" ]

  Thing digital Q1    [ block="Q1" ]
  Thing digital Q9    [ block="Q9" ]

}

Where is my mistake?

Good afternoon
is there anyone who’s using the PLC logo binding together with the latest unstable release of OH2 (at the moment 2.2.0-SNAPSHOT Build #1075).

PLC logo has worked well since last week, but now “PLC Logo” is listed as “installed” in Karaf consol, but when i try to start it, I’m getting the following error:

Error executing command: Error executing command on bundles:
        Error starting bundle 15: Could not resolve module: org.openhab.binding.plclogo [15]
  Unresolved requirement: Import-Package: org.apache.commons.net.util

Anyone with the same issue? Or even better: Does anyone have an advise how to resolve this issue?
Thanks!

Hello @everybody,

after long time, i rewrote the binding: Now much less things are need. Sadly, changes in configuration are not backward compatible to previous version. Updated readme can be found here. And prebuild binary here.

Kind regards,

Alexander

EDIT: Be sure to use openHAB 2.2 or later.

1 Like

Hi,

What happened to the “pulse” feature?

BR,
Jacek

Hi @skazi,

must be ported and debugged: It worked not properly.

Kind regards,

Alexander.

I am new to openhab2 and try to configure my openhab2 by examples.
I have 2 0ba8 for my shutters. Can someone help me with examples of his working configuratiuon.
I use the composition with zPos variant on my logo.My two logos are already online in the PaperUI,
but the configuration of the inputs and outputs is on UNINITIALIZED - HANDLER_CONFIGURATION_PENDING.
I used the example from the documentation and adapted it to my situation.

Thanks.
Andre

Hi @Dreamar,

According to error message, some required parameter are missing or have invalid format. It’s a little bit hard to provide more information about error without your configuration. If you send configuration, at least *.things file, as well binding version via PM, i’ll try to figure out what the problem is.

Kind regrads,

Alexander

Hello everybody,

me again :slight_smile:

Just uploaded new version to https://github.com/falkena/binaries. Small Change-Log:

  1. Reintegrate Pulse-Thing
  2. Remove some old code
  3. Fix some possible NPE’s

Kind regards and happy new year,

Alexander

1 Like

Thanks @falkena!

The pulse thing enabled me to replace this:

// things
Thing  digital Outputs [ kind="Q" ]
Thing  memory  VB0_2   [ block="VB0.2" ]
// items
Switch  Relay3    "Relay#3"   (LOGO1)  { channel="plclogo:digital:PLC01:Outputs:Q4" }
Switch  PLC01_NI2 "PLC01_NI2" (LOGO1)  { channel="plclogo:memory:PLC01:VB0_2:state" }
Switch  VButton2  "VButton2"  (LOGO1)
// rules
rule "forward VButton2 command to logo NI"
when
    Item VButton2 received command
then
    // short pulse
    sendCommand(PLC01_NI2, ON)
    sendCommand(PLC01_NI2, OFF)
end

rule "update VButton2 from logo relay"
when
    Item Relay3 received update
then
    postUpdate(VButton2, Relay3.state)
end

with this:

// things
Thing  digital Outputs [ kind="Q" ]
Thing  pulse   VB0_1   [ block="VB0.1", pulse=100 ]
// items
Switch  Relay1    "Relay#1"   (LOGO1)  { channel="plclogo:digital:PLC01:Outputs:Q2" }
Switch  PLC01_NI1 "PLC01_NI1" (LOGO1)  { channel="plclogo:pulse:PLC01:VB0_1:state" }
// rules
rule "forward Relay1 command to logo NI1"
when
    Item Relay1 received command
then
    sendCommand(PLC01_NI1, ON) // short pulse
end

to make my light switches work as I expect (physical click on the wall and virtual click in habpanel).

Best Regards and happy new year to you too!
Jacek

PS. I know that the base version was overcomplicated but still… the pulse thing made me re-think this and get a simpler solution.

Hi @skazi,

cool :slight_smile: One thing i didn’t catch:
Has sendCommand(PLC01_NI1, ON) any effect on Logo? I failed to set network inputs on Logo this way:
I simply connected NI1 and NI2 to RS-trigger and took a look into online simulation in LogoSoft. Trigger had not changed it state. Should be there any special mapping for NI-blocks in LogoSoftComfort?

Greetings,

Alexander

Hi @falkena,

Works fine for me with following setup:
Zrzut ekranu z 2018-01-11 14-26-56

How would you trigger the pulse if not by sendCommand(PLC01_NI1, ON)?

I had one case where the things would not react as they should but restarting openhab solved it. I was testing different approaches and I think I changed too many things too quickly so openhab was not able to properly re-wire all pieces.

BR,
Jacek

Hi @skazi,

Grrr… I didn’t match your items to things properly yesterday: PLC01_NI1 modifies the address VB0.1 and not memory address of NI1 directly. This way it works. I hoped, that you found a way to write the NI1 address directly without additional mapping to “normal” memory. Seems, that NI-Blocks memory range is read-only. Strange is, that directly write to marker (M-Blocks) memory range works…

Thanks :slight_smile:

Kind regards,

Alexander