Integrate Siemens Logo (plclogo) in OpenHAB 2

i did that too…forgot it, sorry…

you need to change it to a switch as a contact only works for inputs

Switch eg_wo_li_o "Wohnzimmer Licht Status" <light>	(gBadEG) {plclogo="Logo1:Q9"}

regarding your error, maybe it helps to load the demo setting and remove the plclogo again, and try a fresh start from there, that’s what i did to get into it

I uninstalled everything and installed openhab2 totally new and clear. Just copied the .JAR and config, but the same error:

Unresolved requirement: Import-Package: org.openhab.core.binding

But I did fix it with:


feature:install openhab-runtime-compat1x

I can’t remember that I did that before, but anyway, maybe someone else will be helped with that information.

1 Like

This is awesome!!! Now this switch works with my logo, and like I want it.

Do you have also trick how to set up a rollershutter button with two logo inputs, one for up, and one for down, maybe e third one for stop. I don’t know how to set that.

Hi. Try to define something like
In *.items file:

Switch LogoKuppeHoch {plclogo="ShutterControl:VB0.0"}
Switch LogoKuppeRunter {plclogo="ShutterControl:VB0.1"}
Switch LogoKuppeHochActive {plclogo="ShutterControl:Q1"}
Switch LogoKuppeRunterActive {plclogo="ShutterControl:Q2"}
Rollershutter LogoKuppe "Kuppe" <rollershutter>

And in *.rules:

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 "LogoKuppeDrive"
when
  Item LogoKuppe received command
then
  var dir = STOP
  if(LogoKuppeHochActive.state == ON) { dir = UP }
  else if (LogoKuppeRunterActive.state == ON) { dir = DOWN }
  LogoRolloLogic.apply(receivedCommand, LogoKuppeHoch, LogoKuppeRunter, dir)
end

This work as follow:
Switches LogoKuppeHoch/LogoKuppeRunter are used to drive Rollershutter Up/Down.
Switches LogoKuppeHochActive/LogoKuppeRunterActive are on, if rollo currently drives up/down.
Function LogoRolloLogic maps rollershutter commands to properly switches.

Hi Guys,

I hope you don’t mind me hopping in on your thread. I’ve been trying to get plclogo working in openHab2.
I have put the jar file in Addons, Configured the cfg file in Services. I have added an Item where I read one of the Outputs Q4.
I can see the connection in the logs happening, I can see Output Q4 changing from Null to ON in the logs so I know that I am reading the value of Q4 from the plc however I can’t seem to get this value output through the sitemap file.

I’ve spent over a day at this now and I presume it should be simple. I am confused whether or not I need to configure a Things file? I haven’t done this yet but I don’t see it mentioned anywhere that I need to do it.

Here are my files:

Services:

plclogo:Commtech.host=10.2.1.80

plclogo:Commtech.remoteTSAP=0x0200

plclogo:Commtech.localTSAP=0x0100

plclogo:refresh=5000

plclogo:Commtech.model=0BA8

Items:

Switch 						DownstairsHeatingOutputLogo 			{plclogo="Commtech:Q1"}
Switch 						ReadOutputQ4 					{plclogo="Commtech:Q4"}
Switch 						FloodsOutputLogo 				{plclogo="Commtech:Q3"}
Switch 						HeatingOverride "Over-ride Heating" {plclogo="Commtech:VB2.1"}
Switch 						FloodsOverride "Over-ride Floods" {plclogo="Commtech:VB1.1"}

Sitemap:

sitemap demo label="Commtech Heat and Light" {
    Frame label="Date" {
        Text item=CurrentDate
    }

Frame label="Heating"{
		Text item=ReadOutputQ4
		Text item=DownstairsHeatingOutputLogo
	}
}

All I get is below in the BasicUI - I think I am expecting to get the Value of ReadOutputQ4 - not the text ReadOutputQ4

Thanks a lot in advance.
I know this is probably something minor but I can’t figure it out!
Justin

The plclogo binding is a 1.x binding -
You don’t use Things with those
You do need to enable openHAB 1.x compatibility layer as described at
http://docs.openhab.org/tutorials/migration.html#installing-unofficially-supported-openhab-1x-add-ons

What is the log message(s) that you see?

Yes, I have enabled the compatibility with this command:

feature:install openhab-runtime-compat1x

I also turned on the 1.x setting in PaperUI.

Logs:
2017-03-22 12:16:58.149 [ItemStateChangedEvent ] - ReadOutputQ4 changed from NULL to ON
2017-03-22 12:16:58.149 [ItemStateChangedEvent ] - FloodsOverride changed from NULL to OFF
2017-03-22 12:16:58.149 [ItemStateChangedEvent ] - DownstairsHeatingOutputLogo changed from NULL to ON
2017-03-22 12:16:58.149 [ItemStateChangedEvent ] - FloodsOutputLogo changed from NULL to ON
2017-03-22 12:16:58.149 [ItemStateChangedEvent ] - HeatingOverride changed from NULL to OFF
2017-03-22 12:16:58.165 [ThingAddedEvent ] - Thing ‘ntp:ntp:demo’ has been added.

2017-03-22 12:16:49.203 [INFO ] [ng.plclogo.internal.PLCLogoActivator] - PLCLogo binding has been started.
2017-03-22 12:16:51.759 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'plclogo.items’
2017-03-22 12:16:58.061 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - PLCLogoBinding constuctor
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Create new config for Commtech
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Set host of Commtech: 10.2.1.80
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Set local TSAP for Commtech: 0x0100
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Set model for Commtech: 0BA8
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Set remote TSAP for Commtech: 0x0200
2017-03-22 12:16:58.077 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - About to connect to Commtech
2017-03-22 12:16:58.092 [INFO ] [ding.plclogo.internal.PLCLogoBinding] - Connected to PLC LOGO! device Commtech
2017-03-22 12:16:58.092 [INFO ] [b.core.service.AbstractActiveService] - PLCLogo Polling Service has been started

I’m not seeing any relevant errors…

How about a label and format directive in the Item

Switch “Some name [%s]” ReadOutputQ4 {plclogo=“Commtech:Q4”}

Hi,

Thanks for that. Yes that was the issue. I figured it out last night and fixed it by putting the directive in the sitemap file.
Seems strange that none of the examples in the thread or in the wiki showed that the directive needed to be there.
I wonder if that was a openhap2 requirement or was it always there.
Anyway beginners error I guess! Thanks a lot for your help.

Justin

Hello everybody,

PLCLogo binding for Openhab2 is implemented and can be found under:

Documentation is a thing to improve :slight_smile: Please, feel free to report bugs via GitHub.
Pull - requests are welcome anytime.

Would be nice, if somebody will try it and give feedback, if it works so far.
I will make an Pull-Request, if it work for somebody else, than me :slight_smile:

1 Like

Hi Alexander,

i would really like to test the new version, but currently i’m not into development in openhab and relative new to openhab. I didn’t look into setting up an IDE for it and therefor could you provide a compiled version?

I’m currently using the 1.x version on openhab2 with 4x 0BA7 Logo’s for my lights and shutters, even an AQ for dimmable light’s.

Thanks
Jens

Hi,

have added jar to https://github.com/falkena/binaries.
Documentation can be found here: https://github.com/falkena/openhab2-addons/blob/feature/plclogo/addons/binding/org.openhab.binding.plclogo/README.md

And feel free to ask:-)

Greetings,

Alexander

Hey @falkena,

first thanks for your work! :slight_smile:

I’ve two questions regarding the binding:

  1. How could I read a DWord from the logo?
  2. The openHAB1 version of the binding wasn’t threadsafe. So it was possible to completely crash the logo with simultaneous read/writes. Is this bug fixed in the actual version?

Thanks,
BlackAlpha

Hi @BlackAlpha,

I have not implemented VD memory access yet. According to documentation it should be pretty easy to do this:
It’s the same thing, like VW. I’l take a look at this next days. Binding should be thread-safe. Nevertheless, there is a problem, if you try to read/write same value. The reason is, how openHAB and Logo! communication works:
I read the whole memory block for the performance reasons. openHAB publish changes channel after channel.
Means: If there are two channels, there will be a chance, that changes on one of them can be overwritten.
Try to use proxy pattern described above. Additionally, i’ve patched Moka7 library, that now it is possible to send single bit to Logo!. Moka7 in openhab1-version of binding sends a whole byte to Logo! on single bit change, since this patch is not integrated there. And if you work with 0BA8.Standard, firmware versions V1.08.02 and V1.08.03 are buggy. Firmware V1.08.01 and LOGO! 8.FS4 seems to be ok. Assuming you are german:
https://support.industry.siemens.com/tf/ww/de/posts/logo8-nach-undefinierbaren-zeitabst-nden-in-stop/152997?page=0&pageSize=10
https://support.industry.siemens.com/tf/ww/de/posts/aktuelle-firmware-der-logo-8/155966?page=0&pageSize=10

Greetings,

Alexander

1 Like

Hello, i cant seem to understand how to i iństall that addon, if i put the jar file to addon folder it doesnt show up on paper ui ->addons am i missing something ?

Hi @falkena,

thanks for your reply. I’m using 4 Logo 0BA7. If you need someone for testing new builds, contact me via PN (german? :wink: ). Actual I’m completely new to openHAB2 and just trying to understand all the stuff.

Yesterday I’ve installed your 2.10 snapshot for some quick and dirty tests. All 4 Logos were discovered and added as things. If I try to add the digital blocks manually via PaperUI, I get a null pointer exception. Actually I haven’t tried it via Eclipse. What went wrong?

If you need some logs or something else… :slight_smile:

Greetings,
BlackAlpha

Hi @BlackAlpha,

Hmmm… NPE is not good…
To answer your question, debug log would be helpful :slight_smile:

Can you send it via PM, please?

Greetings,

Alexander.

Hi @grefix,

a little bit more information would be helpful. Are you on Windows or Raspberry?
Is there some information in log-file?

Greetings,

Alexander

now it is online after couple restarts and i can see my logo but dont know how to config digital output on things what do i write to the block/memory field ?

windows 10 /Logo 8.FS4

Hi @grefix,

Try to add a digital thing via Paper-UI: Configuration->Things, then “+” sign in the blue circle.
Then choice PLC-Logo binding -> “Add manually” -> “Digital block”.
Then select bridge. It’s your Logo. And then enter, for example Q1 into “LOGO! block/memory” field.
Accept the changes with a “bird” in a blue circle.

This should add “Q1” as digital output thing. As next you need item linked to this channel.

Please, take a look into

“Digital Things” section contains nearly information about valid block names for digital inputs/outputs.

Greetings,

Alexander