Integrate Siemens Logo (plclogo) in OpenHAB 2

openhab2
binding
siemens
Tags: #<Tag:0x00007f51eca13908> #<Tag:0x00007f51eca12ad0> #<Tag:0x00007f51eca116a8>

(Alexander Falkenstern) #175

Hi @wita01,

Please, check local/remote TSAP was set in LogoSoftComfort and bridge configuration. Communication will not work, if they are not set properly. I assume, that Logo can be ping’d.

EDIT: Took the look into commit history: Your configuration is supported by last binding version only. I performed huge refactoring, that was done on 18.01.2018. So, yes, it is good idea to update the binding.

Kind regards,

Alexander.


(Stefan) #176

Hi there

hm… i just connected with LogoSoftComfort again. I’m pretty sure that the TSAP settings are done there. (20.00 and 30.00)
anyway the Log is flooded with

2018-03-10 17:05:25.872 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:05:37.968 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: Data Receiving timeout.
2018-03-10 17:05:42.974 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:05:47.980 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:05:52.986 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:05:57.989 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:06:02.995 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.
2018-03-10 17:06:23.353 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: Data Receiving timeout.
2018-03-10 17:06:28.355 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.0.21: TCP Sending error.

The interesting thing regarding ping: as soon as the Binding is started, Logo doesn’t respond to ping properely anymore. (~75% loss, or 3 out of 4 tries).
If not connected, its response time is 5ms avg (connected via power-line adapter).

One more thing. I was able to send one command (pulse output) one times. Light was going off. Could not be reproduced so far.

any idea?

PS:

I’m trying at a minimum config now - still without success:
*.things

Bridge plclogo:device:LogoRemise [ address="192.168.0.21", family="0BA8", localTSAP="0x3000", remoteTSAP="0x2000", refresh=100 ]
{
  Thing pulse VB2_0 [ block="VB2.0", pulse=400 ] //Taste Aussenfluter aus
  Thing pulse VB2_4 [ block="VB2.4", pulse=400 ] //Taste Aussenfluter ein
}

*.items

Switch   VS_FluterRemise_ein      {channel="plclogo:pulse:LogoRemise:VB2_4:state"}
Switch   VS_FluterRemise_aus      {channel="plclogo:pulse:LogoRemise:VB2_0:state"}

sending “ON” and “OFF” to these items using a rule


(blu) #177

works now, many thanks.
I only use memory type communication with my Logo 8 and everything is perfect.


(Alexander Falkenstern) #178

Hi @wita01,

very strange. Please, try follow: Remove all pulse things/items and create one digital thing. Q-Kind will be fine. Additionally connect DateTime item to RTC channel. RTC will be updated by Logo8 nearly one time a second. Work this configuration properly?

Kind regards,

Alexander.


(Stefan) #179

Good afternoon

just a quick update. Sorry @falkena, I had no time yet to trying out your proposals, but I will give it a try as soon as I find a convenient time slot. Thanks for taking care of my issues!

Since there is another issue on stability of my KNX-communication, my recent suspect has been my hardware/virtualization environment (Hardware: 16GB Ram, Intel i5 3rd generation, SSD Harddrive, Software: VMWare ESXi, Ubuntu 16.x LTS, as well as some Windows/Linux VMs; no high load in the average, according to VMWares onboard performance monitor)
Thus I shortly decided to changing-over to a raspberry Pi, using the official OH2 image.

I basically powered up the system, and transferred all *.items, *.rules, *.things, *.sitemap onto the raspberry (the old system was stopped of course!)
I also placed the PLC-Logo binding in the according folder. After reboot, it appeared immediately as an installed binding in the PaperUI.
What I noticed after creating Logo-Items, was really alarming to me. Not only that the same flood of errors in the log could be noticed right after the activation of the PLC-Logo binding; This seemed to be blocking the entire Ethernet-network.
i.e.: I’m doing all the setup by the use of virtual machine, and working connected via remote desktop connection. As soon as the PLC-Logo binding starts flooding the Log with errors, there is an extreeem lag on the remote-desktop connection.
It seems that after x retries, the plcLogo binding gives up, and remote-desktop is immediately working flawless again. Also as soon as I disconnect the Raspberry from Ethernet, network is up and running flawless immediately again.
Next step for me: Wireshark

Regards,
Stefan


(mads m) #180

Hi
I installed the plclogo-2.3.0-SNAPSHOT and connected a logo8, and I can now read status on input/output.

But I dont know how to write to in/outputs on the logo

My item

Switch  LogoQ4   { channel="plclogo:digital:Logo1:Outputs:Q4" }

My things

Bridge plclogo:device:Logo1 [ address="192.168.0.201", family="0BA8", localTSAP="0x0100", remoteTSAP="0x0200", refresh=100 ]
{
	Thing digital  Outputs [ kind="Q" ]
	Thing digital  Inputs  [ kind="I" ]
}

I have read that I need to set items like as VB to wirte to the logo

Switch ReadWriteBinaryValue {plclogo="plc:VB2.1"} }

but I am not sure how to setup a VB in the logo software, I have made an Network input to control Q4

It is not working, what am I doing wrong.


(Jacek Tomasiak) #181

You need to create digital things for your NIs first, e.g.:

Thing memory VB2_1 [ block="VB2.1" ]

Then you can link them to items like this:

Switch  SwitchNI1 "SwitchNI1" {channel="plclogo:memory:Logo1:VB2_1:state"}

(mads m) #182

thanks i worked :slight_smile:


(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:

logo.items:

// 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"}

logo.things:

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

taster.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
            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
        }
	}
end

home.sitemap:

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.items:

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

//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"}
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 |
  switch(Command)
  {
    case UP: {
      Up.sendCommand(ON)
      createTimer(now.plusMillis(100), [|Up.sendCommand(OFF)])
    }
    case DOWN: {
      Down.sendCommand(ON)
      createTimer(now.plusMillis(100), [|Down.sendCommand(OFF)])
    }
    case STOP: {
      if(Direction == UP) {
        Up.sendCommand(ON)
        createTimer(now.plusMillis(100), [|Up.sendCommand(OFF)])
      } else if (Direction == DOWN) {
        Down.sendCommand(ON)
        createTimer(now.plusMillis(100), [|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

logot.things:

Bridge plclogo:device:Logo1 [ address="192.168.1.11", 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 ] 
}

home.sitemap:

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

Hello,

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: https://github.com/falkena/openhab2-addons/blob/plclogo/addons/binding/org.openhab.binding.plclogo/README.md

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.

Arnd


(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 https://github.com/openhab/openhab2-addons/pull/2286 is still open :frowning:

Kind regards,

Alexander


(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(de.map):%s]" { 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(de.map):%s]"    <door> { channel="plclogo:digital:Logo7:Inputs:I3" } 

Thanks
Arnd


(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,

Alexander


(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

image

and the log says:
2018-06-19 11:25:47.618 [WARN ] [nding.plclogo.internal.PLCLogoClient] - Reconnect during read from 192.168.100.101: 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)

PSS:
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 192.168.0.21 with interval 100 ms.
2018-06-19 20:07:03.536 [INFO ] [ing.plclogo.handler.PLCBridgeHandler] - Creating new RTC job for 192.168.0.21 with interval 500 ms.