Integrate Siemens Logo (plclogo) in OpenHAB 2

@Bastler36 it looks like your “Lichtschalter” things are outside of the “Bridge” thing. Move it together with other things (no need for two “Outputs” things).
Another thing is that I don’t use the observe feature in pulse things. I don’t think it will work with my example and observe.

Thanks a lot, skazi,
To make it more clear for me, can you please explain what you mean, or how it should be?
I followed an example here in this forum.

I just want to have a light switch to turn on a light outside.
Having a light switch would be great. This should give an impule to the relay like for this circuit:

Both actions are quite similiar.
The target is to switch it ON/OFF and to get a Feedback Green=ON/Red=OFF.

Thank you again.

Hi @Bastler36,

Thing pulse VB100_2 [ block=“VB100.2”, observe=“VB100.2”, pulse=500 ] // NI3 rollo control-bit pulse up
Thing pulse VB100_4 [ block=“VB100.4”, observe=“VB100.4”, pulse=500 ] // NI4 rollo control-bit pulse down

it’s not a really good idea to observe the same block as used for setting. The *.thing file shall look as

// Rollos
Bridge plclogo:device:Logo8_3 “Logo8_3” [ address=“192.168.178.14”, family=“0BA8”, localTSAP=“0x2000”, remoteTSAP=“0x1000”, refresh=1000 ]
{
  Thing digital Inputs “Logo8_3 Inputs” [ kind=“I” ]
  Thing digital Outputs “Logo8_3 Outputs” [ kind=“Q” ]
  // Rollo1
  Thing pulse VB100_2 [ block=“VB100.2”, observe=“NI3”, pulse=500 ] // NI3 rollo control-bit pulse up
  Thing pulse VB100_4 [ block=“VB100.4”, observe=“NI4”, pulse=500 ] // NI4 rollo control-bit pulse down
  Thing memory VW27 [ block=“VW27”] // rollo position memory value-word
  // Lichtschalter
  Thing pulse VB200_2 [ block=“VB200.0”, pulse=100 ]
}

Edit: pulse value of 100ms may be too short. Try to increase pulse width to 250

// Lichtschalter
Thing pulse VB200_2 [ block=“VB200.0”, pulse=250 ]

Kind regards,
Alexander

Thank you all for your great support.
I will try this and give you a feedback.

Dear openHAB-Friends,

I succeeded a lot regarding openHAB Bindings like Weather, Calendar, Heat Pump, Fresh Air System, Fuel Prices, etc.
So far so good.

The main problem is to implement my functions I have in my 4 Logo`s.
I know you gave me already hints here, but no one was working.

So I decided to make it more simple for me and created the two sample circuits:

I have the following files:

logo.items

// Licht Garage
Switch          Licht_Garage            "Licht Garage"               <light>           {channel=""}

Switch ReadOutput01 		{channel="plclogo:digital:Logo8_3:Outputs:Q6"}
Switch invisibleSwitch01 	{channel="plclogo:pulse:Logo8_3:VB200_0:state"}



// Licht Treppenhaus
Switch          Licht_Treppenhaus       "Licht Treppenhaus"               <light>           {channel=""}

Switch ReadOutput02 		{channel="plclogo:digital:Logo8_3:Outputs:Q10"}
Switch invisibleSwitch02 	{channel="plclogo:pulse:Logo8_3:VB200_2:state"}

logo.things

Bridge plclogo:device:Logo8_3 [ address="192.168.178.14", family="0BA8", localTSAP="0x2000", remoteTSAP="0x1000", refresh=100 ]
{
	// VB1XX.X = rollershutter
	// VB1XX.0 = up
	// VB1XX.1 = down
	//
	
	// Allgemeine Initialisierung
	Thing digital  Inputs  [ kind="I" ]
	Thing digital  Outputs [ kind="Q" ]
	Thing digital  Marker  [ kind="M" ]
	
	// Fenster WC
	Thing pulse    TH_Taster_Rollo1_Auf 		[ block="VB100.2", pulse=200 ]
	Thing pulse    TH_Taster_Rollo1_Ab  		[ block="VB100.4", pulse=200 ]
	Thing pulse    TH_Taster_Rollo1_Zwischen 	[ block="VB100.9", pulse=200 ]
	Thing memory   TH_Rollo1_Status	 	        [ block="VD27" ]


    // Fenster Haustechnik
	Thing pulse    TH_Taster_Rollo2_Auf 		[ block="VB101.2", pulse=200 ]
	Thing pulse    TH_Taster_Rollo2_Ab  		[ block="VB101.4", pulse=200 ]
	Thing pulse    TH_Taster_Rollo2_Zwischen 	[ block="VB100.9", pulse=200 ]
	Thing memory   TH_Rollo2_Status	 	        [ block="VD29" ]


// Fenster Wohnzimmer Ost
	Thing pulse    TH_Taster_Rollo3_Auf 		[ block="VB102.2", pulse=200 ]
	Thing pulse    TH_Taster_Rollo3_Ab  		[ block="VB102.4", pulse=200 ]
	Thing pulse    TH_Taster_Rollo3_Zwischen 	[ block="VB100.9", pulse=200 ]
	Thing memory   TH_Rollo3_Status	 	        [ block="VD31" 


// Test Licht Garage
	Thing pulse    VB200_0 [ block="VB200.0", observe="Q6", pulse=500 ]

// Test Licht Treppenhaus
	Thing pulse    VB200_2 [ block="VB200.2", observe="Q10", pulse=500 ]

}

taster.rules

// Licht Garage
rule "Switch Light Garage"
when
    Item ReadOutput01 changed or                         // light changed external
    Item Licht_Garage 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 != Licht_Garage.state) { // if state changed really
            Licht_Garage.postUpdate(ReadOutput01.state) // update the state without triggering the rule
        }
	}
end




// Licht Treppenhaus (mit Ausschaltverzögerung)
rule "Switch Light Treppenhaus"
when
    Item ReadOutput02 changed or                         // light changed external
    Item Licht_Treppenhaus received command                  // light changed internal
then
    if(receivedCommand==ON ||receivedCommand==OFF) {     // ensure there was a received command, so second item triggered rule
        if (ReadOutput02.state != receivedCommand) {     // only if state changed
            invisibleSwitch02.sendCommand(ON)                 // send an ON
            invisibleSwitch02.sendCommand(OFF)                // send an OFF
        }
    }
    else {                                                 // no trigger from proxy switch, so state changed externally
        if (ReadOutput02.state != Licht_Treppenhaus.state) { // if state changed really
            Licht_Treppenhaus.postUpdate(ReadOutput02.state) // update the state without triggering the rule
        }
	}
end

sitemap

Text label="Licht" icon="light" {
            Default item=Licht_Garage label="Garage"
            Default item=Licht_Treppenhaus label="Treppenhaus"
        }

Thing 01 is running. If I copy this and rename it like I did (02…) both are not running anymore.

Can please someone give an example, what needs to be renamed considering Switch01 if I want to have two or even more Switches-especially in the logo.things and taster.rules files?

Thank you very much in advance.

grafik

Hi, syntax error?

Thing memory   TH_Rollo3_Status	 	        [ block="VD31" 

vs

Thing memory   TH_Rollo3_Status	 	        [ block="VD31" ]

And is it really double value and not word (VD vs VW) ?

Kind regards,

Alexander

Hi, I’m using the pulse thing to get a short pulse to my trigger input of a Logo Comfort Switch block which is switching my output, like:

Thing pulse Logo204OfficeLight [ block=“VB460.0”, pulse=200 ]

Thats working fine. While reading the docs I came across the “observe” property which I never used before and is somehow confusing me. Can someone please give me a hint for which use-case the “observe” property of the pulse thing is helpful? Documentation says:

If observe is set and differ from block, binding will wait for value change on observe and send then a pulse with length pulse milliseconds to block

But that’s not true! I have the following Thing:

Thing pulse Logo204OfficeLight [ block=“VB460.0”, observe=“Q7”, pulse=200 ]

When changing the “observed” Q7 from off to on (e.g. by using my wall switch) no pulse is sent to VB460.0 as described in the documentation. So what is the “observe” property really mentioned for and which use-case the author had in mind when adding this to the pulse thing?

Hi @PacmanII ,
i think i can answer your question. The main idea was to get feedback from logo, if the change was really received. We have follow network topology: openhab server <-------> Logo. Now, some memory block was modified. It takes some time, the new value arrived on Logo side. OpenHab obeserves the value on “observe” channel with polling intervall. And if, the change was detected, it sends the opposite value after timeout “pulse”. The implementation is very hard due to settings. It depends on relation of pulse length and polling intervall. I tried to draw a timing diagramm: grafik

Kind regards,

Alexander

Dear all,

I have already installed an configured OH3 where I read analog values from my Logo like Temperature, Water Level, etc.

Unfortunately the Values are shown in OH3 with false decimal places:

Target: 2,9°C
actual: 29°C

Target: 83,5% (Water Level in my cistern)
actual: 835%

Until now I didn`t find out how I can change this.
Thank you in advance for any help.

Dear all,

is anyone here wh has already implemented most of his automation in OH3 via PLC?

I have a lot more things running than in OH2. It`s just easier for me to work with OH3.
What is still just partly running is a switch, like for a light.

What I did:

grafik

grafik

→ I turn on the Button (Icon is red)
→ switch colour turns to green/moves to right (function given in SoftComfort, Online Test), Icon turns to green
→ to turn off the light, I must push the button again, colour is not changing

Is there a possibility to do this more comfortable?
Just like using a time relay which deactivates after 1 min (switch moves back to origin position, colour changes from green to red)?

Most of my switches are used with a relais.

I hope it`s possible to understand what I mean.

Thank you.

This is like a pulse relay? Push a button to turn ON , push same button to turn OFF? And of course you have to release the button in between.

Expire feature can do this for you.
But that will leave you with a UI switch that has no relation to whether the real lights are on or off, same as an un-pushed button.

Look here

Thank you both for your support!

@ Bassdriver: I have used the UDF and tried it several times.
If I switch via NI, it pulses but Q will not stay ON (like using a relay).

Have you used this UDF for your configuration?
Did you had success with that?

I thougt there might be a easy way in OH3 to use that.

:wink:

I am still using oh2 so I don’t know. I think the simplest solution is the second last one.

it works perfectly for me ,normal wall switch
oh3 ,logo8!
logo8

UDF
logo8_udf

things

Bridge plclogo:device:Logo8 "Logo8 PLC" [ address="192.168.3.250", family="0BA8", localTSAP="0x0200", remoteTSAP="0x0200", refresh=1000 ]
{
  Thing digital Inputs  "Logo8 Inputs"  [ kind="I" ]
  Thing digital Outputs "Logo8 Outputs" [ kind="Q" ]

  Thing memory    VB100_4   [ block="VB100.4",  force=false ]
}

items


Group:Switch:OR(ON, OFF)   gLight         "Φωτισμός [(%d)]"   <light>
Group:Switch:OR(ON, OFF)   gLightNI         "Όλα τα φώτα [(%d)]" <light>

Switch  Logo8_NI1   "NI1 Light" (gLightNI) ["Lighting"]  { channel="plclogo:memory:Logo8:VB100_4:state" }
Switch  Logo8_NI2   "NI2 Light" (gLightNI) ["Lighting"]  { channel="plclogo:memory:Logo8:VB101_4:state" }
Switch  Logo8_NI3   "NI3 Light" (gLightNI) ["Lighting"]  { channel="plclogo:memory:Logo8:VB102_4:state" }
Switch  Logo8_Q1    "Q1"    (gLight)     { channel="plclogo:digital:Logo8:Outputs:Q1" } 
Switch  Logo8_Q2    "Q2"    (gLight)     { channel="plclogo:digital:Logo8:Outputs:Q2" } 
Switch  Logo8_Q3    "Q3"    (gLight)     { channel="plclogo:digital:Logo8:Outputs:Q3" } 

roule
update openhab for wall switch changes

rule "Logo lights"
when
    Member of gLight changed 
then  
   
    val Logo_Nx= triggeringItem.name.replace("Logo8_Q","Logo8_NI") 

Logo_Nx.postUpdate(triggeringItem.state.toString)
end

Hi mpampinos,

thank you for sharing your configuration.
I`m still dispairing with my PLC-configuration.

I just try to have some switches to get my lights running.
Sometimes one switch workes, others not.

I don`t really know why.
Until I read your comments I have used Pulse Things.

Im also using OH3 with 5 Logos (12/24 RCE and 230 RCE) for more than 90% of my home automation.

Would you please be so kind and provide more information, maybe screenshots about your OH3-configuration?

  • My PLC are all ONLINE
  • I have created for example a thing for Light
  • linked to a Item

With this configuation it`s not working.

I would appreciate it, if you might check what I have done wrong.
Thank you in advance.

kind regard.

do you have items for all channels? NI, Q or NQ
do you have roule for all items ?.

if you copy/paste my things /items in oh3 you will see how it is

Sorry to revive this thread, but I can’t find a better place to post this, because there seems to be no main thread for the plc binding…

If someone got errors with memory things that are in pending state “HANDLER_CONFIGURATION_PENDING” (my log says: “Fehlende oder ungültige Konfiguration.”) after upgrading to 3.3 M1… The solution for this is to change the block addresses for 0X.XX to X.XX.

So for me I needed to change all my memory Things from e.g.

Thing memory VB00_0 [ block="VB00.0" ]
Thing memory VB00_0 [ block="VB01.1" ]

to

Thing memory VB00_0 [ block="VB0.0" ]
Thing memory VB00_0 [ block="VB1.1" ]

Hopefully this will help someone with the same problem :wink:

Hallo Markus, bist du mittlerweile erfolgreich gewesen ? Ich verzweifle aktuell. Meine Logo können einfach nicht mit OH3 kommunizieren. Bei OH2 hat eigentlich alles geklappt. Danke vorab.

Hello Jojo1900,

which comment are you reffering?

Here are some snippets of my config files which are working fine on OH3, hope this helps everybody:

lights.items

//
// Logo 1
// 

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

// FF_LivingRoom_Light
Switch ReadOutput02 		{channel="plclogo:digital:Logo1:Outputs:Q9"}
Switch invisibleSwitch02 	{channel="plclogo:pulse:Logo1:VB126_2:state"}

rollershuter.items

/////////////
// Logo 1 //
////////////


//FF_LivingRoom_Shutter
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"}
Number invisiblePosition01 		{channel="plclogo:memory:Logo1:VD150:value" }

//FF_LivingRoom_Shutter_2
Switch ReadOutputUp02			{channel="plclogo:digital:Logo1:Outputs:Q14"}
Switch invisibleSwitchUp02		{channel="plclogo:pulse:Logo1:VB101_0:state"}
Switch ReadOutputDown02			{channel="plclogo:digital:Logo1:Outputs:Q13"}
Switch invisibleSwitchDown02	{channel="plclogo:pulse:Logo1:VB101_1:state"}
Number invisiblePosition02 		{channel="plclogo:memory:Logo1:VD154:value" }

lights.rules

rule "Switch Light through Logo_1"
when
    Item ReadOutput01 changed or                         // light changed external
    Item FF_Dining_Light 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
        }
    }
    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
        }
	}
end

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

rollershutter.rules

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 |
  switch(Command)
  {
    case UP: {
      Up.sendCommand(ON)
      //createTimer(now.plusNanos(100000000), [|Up.sendCommand(OFF)])
    }
    case DOWN: {
      Down.sendCommand(ON)
      //createTimer(now.plusNanos(100000000), [|Down.sendCommand(OFF)])
    }
    case STOP: {
      if(Direction == UP) {
        Up.sendCommand(ON)
        //createTimer(now.plusNanos(100000000), [|Up.sendCommand(OFF)])
      } else if (Direction == DOWN) {
        Down.sendCommand(ON)
        //createTimer(now.plusNanos(100000000), [|Down.sendCommand(OFF)])
      } else if (Direction != STOP) {
        logDebug("LogoRolloLogic", "Direction " + Direction + " is not supported.")
      }
    }
  }
]

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

rule "rollershutter01 status"
when
  Item invisiblePosition01 changed
then
    if(invisiblePosition01.state==2 ) {   
       FF_LivingRoom_Shutter.postUpdate(0)                
		sendLogNotification("state=2")	
    }
    if (invisiblePosition01.state==1 ) {             
		sendLogNotification("state=1")		
        FF_LivingRoom_Shutter.postUpdate(50)  
	}
    if (invisiblePosition01.state==0 ) {             
		sendLogNotification("state=0")		
        FF_LivingRoom_Shutter.postUpdate(100)  
	}
end



rule "rollershutter02"
when
  Item FF_LivingRoom_Shutter_2 received command
then
  var dir = STOP
  if(ReadOutputDown02.state == ON) { dir = UP }
  else if (ReadOutputUp02.state == ON) { dir = DOWN }
  LogoRolloLogic.apply(receivedCommand, invisibleSwitchDown02, invisibleSwitchUp02, dir)
end

logo.things




// Logo 1
// VB100: Rollershutter
// VB125: Lights
// VD150: Rollershutter status 

// Logo 2
// VB200: Rollershutter
// VB225: Lights
// VD250: Rollershutter status 

// Logo 3
// VB300: Rollershutter
// VB325: Lights
// VD350: Rollershutter status 
//

// Rollershutter
// VBXXX.0 = Up
// VBXXX.1 = Down
// VBXXX.2 = Between
// VBXXX.3 = Deactivate


// Lights
// VBXXX.0 = Off
// VBXXX.1 = On
// VBXXX.2 = Toggle
// VBXXX.3 = Deactivate



Bridge plclogo:device:Logo1 [ address="192.168.1.XX", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
{

	
	// generally initialization
	Thing digital  Inputs  [ kind="I" ]
	Thing digital  Outputs [ kind="Q" ]
	
	// Wohnzimmer RLM Tuer
	Thing pulse    VB100_0 [ block="VB100.0", observe="Q11", pulse=500 ]
	Thing pulse    VB100_1 [ block="VB100.1", observe="Q12", pulse=500 ]
	Thing pulse    VB100_2 [ block="VB100.2", pulse=500 ]
	Thing memory   VD150   [ block="VD150", force=true ]
		
	// Wohnzimmer RLM Fenster
	Thing pulse    VB101_0 [ block="VB101.0", observe="Q14", pulse=500 ]
	Thing pulse    VB101_1 [ block="VB101.1", observe="Q13", pulse=500 ]
	Thing pulse    VB101_2 [ block="VB101.2", pulse=500 ]
	Thing memory   VD154   [ block="VD154", force=true ]
	
	// Esszimmer Licht
	Thing pulse    VB125_0 [ block="VB125.0", observe="Q1", pulse=500 ] 
	Thing pulse    VB125_1 [ block="VB125.1", observe="Q1", pulse=500 ] 
	Thing pulse    VB125_2 [ block="VB125.2", observe="Q1", pulse=500 ] 
	
	// Wohnzimmer Licht
	Thing pulse    VB126_0 [ block="VB126.0", observe="Q9", pulse=500 ] 
	Thing pulse    VB126_1 [ block="VB126.1", observe="Q9", pulse=500 ] 
	Thing pulse    VB126_2 [ block="VB126.2", observe="Q9", pulse=500 ] 
	
}

home.sitemap

sitemap home label="Home" {

        Text label="Licht" icon="light" {

            Default item=FF_LivingRoom_Light
            Default item=FF_Dining_Light

        }



        Text label="Rolladen" icon="rollershutter" {
            Default item=FF_LivingRoom_Shutter 
	    Default item=FF_LivingRoom_Shutter_2


        }
}