Integrate Siemens Logo (plclogo) in OpenHAB 2

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


        }
}