Integrate Siemens Logo (plclogo) in OpenHAB 2

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

Here a tutorial for rollershutters: PLCLogo Solution: Logo Rollershutter Control

Hi !

I’m still trying during last weeks with my logos (i have 4 of them) to migrate this from fhem (where its still working with memory bits , fhem does trigger 1s via web command)
Its seems for me that openhab does not pulse… plc program is similar to solutions (use comfort swithc with 2 OR Inputs)
I can see the states of Q and so on… but proxy switch does not follow the Output and also output is not switched…
Also i get folowing log in events.log
2020-01-10 01:46:04.602 [vent.ItemStateChangedEvent] - FF_Buero_Light changed from ON to OFF
2020-01-10 01:46:04.612 [ome.event.ItemCommandEvent] - Item ‘TEST_BUERO’ received command ON
2020-01-10 01:46:04.614 [ome.event.ItemCommandEvent] - Item ‘TEST_BUERO’ received command OFF
2020-01-10 01:46:04.615 [nt.ItemStatePredictedEvent] - TEST_BUERO predicted to become NULL
2020-01-10 01:46:04.616 [nt.ItemStatePredictedEvent] - TEST_BUERO predicted to become NULL

The difference between on and off is 1 ms regardless how much i set as pulse… and also the NULL is a misery…

Ciao Gerd

Look at this Post or the other Posts in this Topic. They may help you.

Greetings Markus

Hi ! I read all these posts (also yours)
I can’t use M’s because nearly all are in use
I tried the other solutions with the vb 0.1 or similar and for me it seems that vb is not pulsed otherwise light shoudl go on and off

Ciao Gerd

Than you have to provide some configs of yours. (.items / .things / .rules / .sitemap)

Hi
OK
things

Bridge plclogo:device:logo_kg [ address=“192.168.63.101”, family=“0BA7”, localTSAP=“0x2000”, remoteTSAP=“0x2400”, refresh=200 ]
{
Thing digital KG_Outputs “Logo KG Ausgaenge” [ kind=“Q” ]
Thing pulse TEST_BUERO “Buero_Test” [ block=“VB100.4”, observe=“VB100.4”, pulse=“600”]
}

Item

Switch Licht_Buero “Buero Licht” { channel=“plclogo:digital:logo_kg:KG_Outputs:Q5” }
Switch TEST_OFFICE “Schalter Licht Essbereich” { channel=“plclogo:memory:logo_kg:TEST_BUERO:state” }
// virtual Switch
Switch FF_Buero_Light “Licht”

rule

rule “Switch Light Buero through Logo”
when
Item Licht_Buero changed or // 1. light changed external
Item FF_Buero_Light received command // 2. light changed internal
then
if(receivedCommand==ON || receivedCommand==OFF) { // ensure there was a received command, so second item triggered rule
if (Licht_Buero.state != receivedCommand) { // only if state changed
TEST_OFFICE.sendCommand(ON)
// TEST_OFFICE.sendCommand(OFF) // send an OFF, maybe not required
}
}
else { // no trigger from proxy switch, so state changed externally
if (Licht_Buero.state != FF_Buero_Light.state) { // if state changed really
FF_Buero_Light.postUpdate(Licht_Buero.state) // update the state without triggering the rule
}
}
end

sitemap

Group item=Buero label=“Buero” icon=“office”
{
Text item=Licht_Buero label=“Licht” icon=“light”
Default item=TEST_OFFICE label=“Debug NI1 (do not touch)”
Default item=FF_Buero_Light label=“EZ Licht (switch here)” icon=“light”
}

Hope this helps

Ciao Gerd