Integrate Siemens Logo (plclogo) in OpenHAB 2

Hi @tv-arnd,
sorry about late reply, i was quite busy last days. Regarding your questions
My sitemap is very simple:

Switch item=Rollo 

The scaling factor is not really self-explained. I set it to max(T_Up, T_Do) * 100. Example: If T_Up is 17seconds and T_Do 15seconds, then T_Sc will be 1700. That’s right: Counting is more or less precise for one direction only. My wife told me, that rollos must be opened completely and closed with some gaps :roll_eyes: It was a time to think really hard: Each motor has physical endpoints. Means, i can drive high as long i will. But down i must measure the time the rollo will stop: i was simply too lazy to setup motor endpoints with a screwdriver :slight_smile: The program can be extended to calculate rest time to drive dependend on current position. My Logo program for Easter calculation is meanwhile done, so why not take a look :slight_smile:
And yes, you can use

Thing pulse VB2_6  [ block="VB2.6", observe="VB2.6", pulse=500 ]

instead of

Thing pulse VB2_6  [ block="VB2.6", observe="NI23", pulse=500 ]

BTW: I would couple emergency signal with both directions and wire them to R trigger input

Kind regards,

Alexander

Ok, Rollo goes up & down controlled via the UI up/down-buttons. Rollo stops using the UI’s up/down-buttons. Rollo STOP does not work using the UI’s X-button.
Error in Log: [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘RolloDrive’: Unknown variable or command ‘==’; line 11, column 11, length 15
Something is wrong with the code line

      if (Direction == UP) {

Hi @tv-arnd.
try to add follow lines at top of the rule file:

import org.eclipse.smarthome.core.types.Command
import org.eclipse.smarthome.core.types.RefreshType
import org.eclipse.xtext.xbase.lib.Procedures

Kind regrads,

Alexander

Hello everybody,

again update in binary repository: Hardening pulse thing on slow network.

Kind regards,

Alexander

1 Like

@falkena, allright with the 3 'import’s it works.
I do not see any button-activity (e.g. color change, when button is pressed - would by nice to see the ‘down’-button highlighted when rollo goes down).
RolloShutter_sitemap

The following one gave me a hard time :wink:

Contact RolloIsHi     { channel="plclogo:pulse:LogoController:VB2_6:observed" }
Contact RolloIsDo     { channel="plclogo:pulse:LogoController:VB2_7:observed" }

Actually, these are not used at all?
Tutorial is in the making.

@falkena I have intalled the new binding version 2.5.0.
I can still ‘create’ hanging pulse things (i.e. NI stays ON forever, Logo flashing required). Can be reproduced with the 2nd example in
https://community.openhab.org/t/plclogo-solution-logo-output-switching/64264/2
This happens if the Logo-refresh time is longer than the pulse-length!! I think it is a good design guideline to make a pulse at least twice as long as the Logo-refresh time.

@All Just try the new binding:

  1. de-install Logo-binding with Paper UI
  2. download and copy *.jar to openhab2-addons directory
  3. (may re-start openHAB). New PLClogo binding does not appear in Paper UI ,but works :slight_smile:

Regards,
Arnd

Hi @tv-arnd,

Ok. This case i haven’t tested :slight_smile: Is the case, if pulse is longer than refresh time, work now without issues? If yes, then i’ll raise PR and add hint to documentation.

Thanks and kind regards,

Alexander

@tv-arnd @falkena I think I’ve just hit the “stuck NI” problem. I had pulse=200 with refresh=100. What I did was a “double click” in habpanel. This triggered the pulse command too quickly and left the item in ON state. After that, the habpanel button didn’t work as expected (sending ON to item which is ON), but in paperui I was able to still trigger the pulse on the NI item but it was “reversed”. Most of the time the item was ON but when I clicked it in paperui it got OFF for a short time and then returned to ON. This correctly toggled the output in LOGO. Maybe this will help debug this problem.

BR,
Jacek

Hi All,

Find below a proposal for light-switching with Logo’s comfort-switch. Very deterministic, because no proxy-switch, no pulse, simple rule.

I have created a new comfort-switch (UDF) - may could be optimised. The principle is that parallel operation of a physical wall-switch and a NI (network input) shall be possible. NI is an on/off switch (can be triggered by openHAB, displays the light’s status and follows the light’s Q per rule)

OH_Logo_Comfort-Switch

Cases:

  1. classical switching on/off Q from wall-switch (permanent or with auto-off)
  2. on/off switching Q from NI network-switch (permanent)
  3. switching on Q from wall-switch by a long press, switching off by NI
  4. switching on Q from NI, switching off by wall-switch

@falkena

Problem with 3: when light Q is switched permanently ON by wall-switch, openHAB’s NI follows, but switching NI off does not work (requires NI to go off, then on, then off). All logged fine. In other words, NI going off does not trigger Logo Q to go off.

Problem with 4: when light Q is switched permanently ON by NI, Q can be switched of by wall-switch. But cannot be switched on again by wall-switch

This works fine in the Logo simulation.

Find the UDF here (rename pdf to zip): OH_Logo_Comfort-Switch.pdf (35.5 KB)

Things

Bridge plclogo:device:Logo7 "Logo7 PLC" [ address="192.168.xxx.yyy", family="0BA7", localTSAP="0x0200", remoteTSAP="0x0200", refresh=1000 ]
{
  Thing digital Inputs "Logo7 Inputs"    [ kind="I" ]
  Thing digital Outputs "Logo7 Outputs"  [ kind="Q" ]
  Thing memory   VB100_4   [ block="VB100.4", observe="NI5" ] // Light
}

Items

Switch  Logo7_Q8    "Q8"    { channel="plclogo:digital:Logo7:Outputs:Q8" }
Switch  Logo7_NI5   "NI5 Licht Wohnen L"  <light>  { channel="plclogo:memory:Logo7:VB100_4:state" }// Light

Anything wrong, how I turned a ‘memory’ into a ‘switch’? (there is no NI for Logo 0BA7 / state vs. observed?).

Sitemap

sitemap default label="Haus" {
Frame label="Light Switch"  {
    Switch item=Logo7_NI5 mappings=[OFF="AUS", ON="EIN"] // Light
   }
}

Rules (super simple, no proxy-switch required!!)

rule "Switch Light Wohnen L Logo"
when
    Item Logo7_Q8 changed                         // light changed
then
    Logo7_NI5.postUpdate(Logo7_Q8.state) // NI always follows Q
end

rule "Startup"
when
   System started
then
    logInfo("StartUp", "System startup: Logo states flushed into proxy switches")
    Logo7_NI5.postUpdate(Logo7_Q8.state)  // update the state at startup
end

NI is written twice in some cases: NI manually switched off, Q goes of, NI follows to off (again). Problem?

Maybe I’m missing something obvious but is there some way to write to one-bit NI other than with pulse thing?
I want to implement “keep NI on as long as some openhab item is on logic” and can’t get it to work.

I tried:

  1. digital thing with block=“VBx.x” -> block is not supported (only general “kind” parameters)
  2. memory thing with block=“VBx.x” -> looking at the code here https://github.com/openhab/openhab2-addons/blob/master/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/config/PLCMemoryConfiguration.java#L70 it seems that memory is only for reading outputs from LOGO not for writing inputs (compared to https://github.com/openhab/openhab2-addons/blob/master/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/config/PLCPulseConfiguration.java#L58 in pulse thing)
  3. pulse thing -> this works but only for as long as the pulse and I want it to be on as long as the triggering item

@falkena any thoughts/ideas?

Hi @tv-arnd, @skazi,

It seems you catched a bug with writing into memory address. I’ll try to take a look this weekend.

Kind regrads,

Alexander

Is this version newer or older than 2.5.0.M1?

I use 2.5.0.M1 and have problems with hanging pulses, even if they are 600ms long (so several times longer than refresh time).

I still have problems with hanging pulses using the 2.5.0.201902182038 version of the PLCLogo-binding.

This can be triggered by “racing” commands (sending multiple commands during short time - or mabye a second command just at the right time). See https://github.com/falkena/openhab2-addons/issues/9 for details.

Maybe there could be a simple pulse thing that don’t use the observer at all?

I have had the same problem, so i used digital things an make my Pulses on the LOGO itself with falling and rising edge. Look at my Poste here:

@falkena is there a reason why NI can’t be used in digital switch things ?

1 Like

Hallo,
I have my configuration running. But how do I get it that fits the Rollershuttericon to the status? I have an item with the states 0 = 0%, 1 = 1-99%, 2 = 100%. I want the rollershutter icon “rollershutter-0 for 0%”, the “rollershutter-50 for 1-99%” and the “rollershutter-100 for 100%”.

*.things
Thing pulse    Rollo_Terasse_Tuer_Auf 		[ block="VB2.0", pulse=400 ]
Thing pulse    Rollo_Terasse_Tuer_Ab  		[ block="VB2.1", pulse=400 ]
Thing pulse    Rollo_Terasse_Tuer_Zwischen 	[ block="VB2.2", pulse=400 ]
Thing memory   Rollo_Terasse_Tuer_Status 	[ block="VD120" ]

*.items
Rollershutter   EG_Terasse_Tuer_Rollade	  	"Terasse Tuer [%d %%]"     <rollershutter>    (EG_Wohnzimmer, gShutter)    ["Rollershutter"]          {channel=""}
Switch  EG_Rollo_Terasse_Tuer_Auf      	"Terasse Tuer Auf" 	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Auf:state" }
Switch  EG_Rollo_Terasse_Tuer_Hoch      "Terasse Tuer Hoch"   	{ channel="plclogo:digital:Logo1:Outputs:Q11" }
Switch  EG_Rollo_Terasse_Tuer_Ab 	    "Terasse Tuer Ab" 	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Ab:state" }
Switch  EG_Rollo_Terasse_Tuer_Runter    "Terasse Tuer Runter"   { channel="plclogo:digital:Logo1:Outputs:Q12" }
Switch  EG_Rollo_Terasse_Tuer_Zwischen 	"Terasse Tuer Zwischen"	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Zwischen:state" }
Number  EG_Rollo_Terasse_Tuer_Status	"Terasse Tuer Status"		{ channel="plclogo:memory:Logo1:Rollo_Terasse_Tuer_Status:value" }

*.Sitemap
Default item=EG_Terasse_Tuer_Rollade label="Terasse Tuer"

Hey,

I have used Rollershutter for my Garage and it worked. So i have altert it for your usecase.
I think you use this Frickelzeugs Rollo-UDF. This means that the status number means 0=closed=100% and 2=Open=0%
I have commented out the part where I use sthe Stop button vor the “Zwischen Position” it is ur decision to use it.

*.things
Thing pulse    Rollo_Terasse_Tuer_Auf 		[ block="VB2.0", pulse=400 ]
Thing pulse    Rollo_Terasse_Tuer_Ab  		[ block="VB2.1", pulse=400 ]
Thing pulse    Rollo_Terasse_Tuer_Zwischen 	[ block="VB2.2", pulse=400 ]
Thing memory   Rollo_Terasse_Tuer_Status 	[ block="VD120" ]

*.items
Rollershutter   EG_Terasse_Tuer_Rollade	  	"Terasse Tuer [%d %%]"     <rollershutter>    (EG_Wohnzimmer, gShutter)    ["Rollershutter"] {autoupdate="false"}
Switch  EG_Rollo_Terasse_Tuer_Auf      	"Terasse Tuer Auf" 	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Auf:state" }
Switch  EG_Rollo_Terasse_Tuer_Ab 	    "Terasse Tuer Ab" 	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Ab:state" }
Switch  EG_Rollo_Terasse_Tuer_Zwischen 	"Terasse Tuer Zwischen"	{ channel="plclogo:pulse:Logo1:Rollo_Terasse_Tuer_Zwischen:state" }
Number  EG_Rollo_Terasse_Tuer_Status	"Terasse Tuer Status"		{ channel="plclogo:memory:Logo1:Rollo_Terasse_Tuer_Status:value" }

*.rules
rule "Rollade UP"
when
    Item EG_Terasse_Tuer_Rollade received command UP
then
    EG_Rollo_Terasse_Tuer_Auf.sendCommand(ON)
end

rule "Rollade DOWN"
when
    Item EG_Terasse_Tuer_Rollade received command DOWN
then
    Rollo_Terasse_Tuer_Zwischen.sendCommand(ON)
end

//rule "Rollade Zwischen"
//when
//    Item EG_Terasse_Tuer_Rollade received command STOP
//then
//    EG_Rollo_Terasse_Tuer_Ab.sendCommand(ON)
//end

rule "Rollade Status"
when
    Item EG_Rollo_Terasse_Tuer_Status changed
then
    if (EG_Rollo_Terasse_Tuer_Status.state == 0) {
        EG_Terasse_Tuer_Rollade.postUpdate(100)
    }
        if (EG_Rollo_Terasse_Tuer_Status.state == 1) {
        EG_Terasse_Tuer_Rollade.postUpdate(50)
    }
        if (EG_Rollo_Terasse_Tuer_Status.state == 2) {
        EG_Terasse_Tuer_Rollade.postUpdate(0)
    }
end

*.Sitemap
Default item=EG_Terasse_Tuer_Rollade label="Terasse Tuer" icon="rollershutter"

if this dosent Work we can PM in German as long as the solution is posted here.

Thank you Bussdriver. It Works.

Does anyone know how to color the UP or DOWN buttons on a rolleshutter when an item is active? Or does that work with labelcolor? If yes how? it is enough for me if the label is green when the item is active.

Hallo,

how can I query the status of a flag? (Merker M8)
dreamar

Hello
First of all Read
PLCLogo Documentation

but here is a summary

//Things
Bridge plclogo:device:<DeviceId> [ address="<ip>", family="<0BA7/0BA8>", localTSAP="0x<number>", remoteTSAP="0x<number>", refresh=<number> ] 
{
Thing digital <ThingId> "Label" @ "Location" [ kind="M", force=<true/false> ]
}

//Items
Contact itemname   { channel="plclogo:digital:<DeviceId>:<ThingId>:M8" }

Greetings Markus