Integrate Siemens Logo (plclogo) in OpenHAB 2

Hi @Petos,

you can parameter such timers via analog things: https://github.com/falkena/openhab2-addons/tree/plclogo/addons/binding/org.openhab.binding.plclogo You need configure the analog thing as “time” type. Then you can connect value channel to DateTime item. Be sure to map timer properties to memory in Logo! SoftComfort. This item can be then used in sitemap.

Kind regards,

Alexander.

Hi @falkena,
yes, i did it, but how to change in OpenHab/BasicUI ? Setpoint can change only number. No time format. I can show it, but i can`t to change it.
Best Regards
Petr

Hi @Petos,

i see. There are two solutions to get it run. Any solution need virtual items:

  1. Create number item and configure it with Setpoint. Create a rule to recalculate Number values to DateTime values and change analog thing, configured as “time”.
  2. Create number item and configure it with Setpoint. Create a raule to recalculate Number values to BCD-coded Number values and change analog thing, configured as “number”.

There is no simplier solution available, since Logo time/date values are BCD encoded. Additionally you need to do some bitmasking to map values to WORD’s properly. See PLCAnalogBlockHandler.java setData function for details.

Kind regards,

Alexander

Hi,
something is wrong with my plclogo binding. State frozen 2 days ago and i can’t control anything. I made update and upgrade.

I made update to OH 2.1 today and still is frozen…
Thanks for help.
Petr

Hi again,
i made new fresh install Raspbian on my RPI3, OH 2.1 via hasslefree scripts.
PLC Logo binding dont work. I put same and working configurations (cfg, things, items, sitemaps) I thing that every binding in /addons dont working…
So i restarted Logo! too.
LogoApp by Siemens in my mobilephone works good.
Any idea?
Petr

edit: No things in paperUI nor Karaf…

Hi @Petos,

it’s really hard to get an idea without knowledge what’s going on your system setup. Is there any information in your log files? Did you delete tmp and cache folder before reinstall? Can you login to karaf console via ssh? What is the binding state? Is there some additional information in debug/trace log level?

Edit: Take a look here, may be it helps: Raspberry Pi 3 / B Rev 1.2 Update from 2.0 to 2.1.0-1 go wrong / no WEB Interface / no logs

Kind regards,

Alexander

Hi @falkena,
i made fresh new install on new SD card.
Now i see only warnings about transformation.

2017-07-02 14:47:05.094 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '-' with the file 'logo.map' : Target value not found in map for '-'

Because every state is “-”

When i delete plclogo.things and put it again:

2017-07-02 15:20:32.101 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'plclogo.things'
2017-07-02 15:20:32.112 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'plclogo.things' is either empty or cannot be parsed correctly!
2017-07-02 15:20:32.236 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'plclogo.things'

My plclogo.things:

Bridge plclogo:device:Logo1 [ address="192.168.0.30", family="0BA8", localTSAP="0x0300", remoteTSAP="0x0200", refresh=500 ]
{
	Thing analog AM_Hladina_NA					[ block="AM1", type="number" ]
	Thing analog AM_Hladina_KS					[ block="AM2", type="number" ]
	Thing analog AM_Hladina_VS					[ block="AM3", type="number" ]
	
  	Thing analog VW_Nast_hladina_NA				[ block="VW50", type="number" ]
  	Thing analog VW_Start_zavlah_1				[ block="VW24", type="time" ]
    //Thing analog VW_Start_zavlah_2				[ block="VW26", type="time" ]
  	Thing analog VW_Interval_zavlah_1			[ block="VW14", type="number" ]
  	Thing analog VW_Interval_zavlah_2			[ block="VW16", type="number" ]
  	Thing analog VW_Interval_zavlah_3			[ block="VW18", type="number" ]
  	Thing analog VW_Interval_zavlah_4			[ block="VW20", type="number" ]
  	Thing analog VW_Interval_zavlah_K			[ block="VW22", type="number" ]
    Thing analog VW_Start_spin_zas_1			[ block="VW28", type="time" ]
    Thing analog VW_Stop_spin_zas_1				[ block="VW30", type="time" ]
    Thing analog VW_Start_spin_zas_2			[ block="VW32", type="time" ]
    Thing analog VW_Stop_spin_zas_2				[ block="VW34", type="time" ]
  
	Thing digital Q_PWM 						[ block="Q1" ]
  	Thing digital Q_Cerpadlo_KS					[ block="Q2" ]
  	Thing digital Q_Cerpadlo_VS					[ block="Q3" ]
  	Thing digital Q_Spinane_zasuvky				[ block="Q4" ]
  	Thing digital Q_Kanalizacni_ventil			[ block="Q5" ]
  	Thing digital Q_Zavlahy_1					[ block="Q8" ]
  	Thing digital Q_Zavlahy_2					[ block="Q9" ]
  	Thing digital Q_Zavlahy_3					[ block="Q10" ]
  	Thing digital Q_Zavlahy_4					[ block="Q11" ]
  	Thing digital Q_Zavlahy_K					[ block="Q12" ]
  
  	Thing digital VB_Kanalizacni_ventil			[ block="VB100.0" ]
  	Thing digital VB_Spinane_zasuvky			[ block="VB108.0" ]
  	Thing digital VB_Casovac_spinanych_zasuvek	[ block="VB105.0" ]
  	Thing digital VB_Casovac_zavlah				[ block="VB110.0" ]
  	Thing digital VB_Cerpadlo_KS				[ block="VB107.0" ]
  	Thing digital VB_Cerpadlo_VS				[ block="VB109.0" ]
  	Thing digital VB_Start_zavlah				[ block="VB103.0" ]
    Thing digital VB_Start_zavlah_vetev_1				[ block="VB111.1" ]
    Thing digital VB_Start_zavlah_vetev_2				[ block="VB111.2" ]
    Thing digital VB_Start_zavlah_vetev_3				[ block="VB111.3" ]
    Thing digital VB_Start_zavlah_vetev_4				[ block="VB111.4" ]
    Thing digital VB_Start_zavlah_vetev_K				[ block="VB111.5" ]
}

BR
Petr

edit:
there isn`t plclogo bindings.


I tried 2.1 and 2.2 snapshots…

Hi @Petos,

ok. If there is no Logo! binding load, than nothing will work. I rebuild binding for some days to 2.2 snapshot. Can you grab it from my binary repository and try? Be sure to delete 2.1 version before. Is binding load this time? If not, please set openhab log level to debug, stop openhab, delete log files and start openhab again. May be we can get some clue, what happens.

Kind regards,

Alexander.

PS: I’ve checked my installation again: it works fine on my test system.

Hi @falkena,
i made it as you wrote, but i can`t something interested in logs.
https://drive.google.com/drive/folders/0B-E5VEp7LNlnSE1fTmhnSHdUa3c?usp=sharing

BR

Petr

Hi @falkena,
how to manualy install bindings via karaf console?
Could you help?
I will try it.
BR
Petr

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!