Integrate Siemens Logo (plclogo) in OpenHAB 2

Hi @falkena,

Sure, but:

  1. I have the wiring done differently with one Q for power and another one for direction instead of Q for up and down.
  2. it’s not as nice as yours (structure and formatting).

BR,
Jacek

Hi @skazi,

Cool :slight_smile: Hardware lock is more safe as software one i use (see my post above). I’ll rewire relais at least 2 years. This spring it’s time to do this.

I hope, i can get the logic. I hope to get an idea, if it’s possible to have less M-Blocks.

Kind regards,

Alexander

Hi @falkena

Here’s my roller-shutter-controller UDF:


By number of blocks it could look more complicated but many of these are just basic functions blocks and the logic for different wiring is also a bit hard to compare.

And this is the UDF definition file: roller-shutter-controller.lma.xml (19.9 KB) (remove the xml extension!)

BR,
Jacek

Hi @skazi,

thanks :slight_smile:

Kind regards,

Alexander

Hello everybody,

i hope, i’ve fixed pulse-thing. Please, find updated version in my binary repository.
If it works, i’ll open PR to main repository.

Kind regards,

Alexander

Sorry, I don’t get the Pulse thing.

The updated documentation states:

If observe is not set or set equal block , simply pulse with length pulse milliseconds is send to block . If observe is set and differ from block , binding will wait for value change on observe and send then a pulse with length pulse milliseconds to block. Please note, update rate for change detection depends on bridge refresh value. For both use cases: if block was 0 then 1 is send and vice versa.

So. If the observed block does not change, the pulse is never sent?

In your rollershutter example, NI23 or NI24 can never change, because V2.6 (or V2.7) never change value, because the Binding will never send a pulse?

Do you mean that the pulse is only sent, if the observed state differs from the state of the Switch item?

@falkena maybe adding some timing diagram for the pulse thing (like this: https://upload.wikimedia.org/wikipedia/commons/f/fc/SR_latch_impulse_diagram.png) would finally solve the confusion?

Continuing the discussion from Integrate Siemens Logo (plclogo) in OpenHAB 2:

Hello everybody,
i just tried to figure out how this works. At the moment I can’t write Network inputs on my Logo 8.
I am gonna show you my settings.
PLCGarten.items:

Contact PLCGarten_24V   "24V Ok" { channel="plclogo:digital:PLCGarten:NetworkOutputs:NQ1:state" }
Contact PLCGarten_I2    { channel="plclogo:digital:PLCGarten:NetworkOutputs:NQ2:state" }
Switch  PLCGarten_R1    { channel="plclogo:digital:PLCGarten:NetworkInputs:NI1" }
Switch  PLCGarten_R2    "Licht 1"   <light>  { channel="plclogo:digital:PLCGarten:NetworkInputs:NI2" }
Switch  PLCGarten_R3    "Licht 2"   <light>  { channel="plclogo:digital:PLCGarten:NetworkInputs:NI3" }
Switch  PLCGarten_R4    "Licht 3"   <light>  { channel="plclogo:digital:PLCGarten:NetworkInputs:NI4" }

PLCGarten.things

Bridge plclogo:device:PLCGarten [ address="192.168.xxx.xxx", family="0BA8", localTSAP="0x3000", remoteTSAP="0x2000", refresh=100 ]
{
    Thing digital   Inputs  [ kind="I"]
    Thing digital   Outputs [ kind="Q" ]
    Thing digital   NetworkOutputs  [ kind="NQ" ]
    Thing digital   NetworkInputs   [ kind="NI" ]
}

With this configuration my PaperUI shows me this:

I think this fine and should just work.
This ist what i programmed on my Logo:
Programm

In the Network overwiew i made an serverconnection:

Can you tell me what I am missing? Thank you for your help!

Hi @eXact,

you need memory thing for each network input. On example for NI1

  Thing memory VB30_0 [ block="VB30.0" ]

EDIT: Inputs are contacts, output are switches. Please, fix the *.items

Kind regards,

Alexander

1 Like

Hi @skazi,

good idea! I’l take a look as my time allows.

Kind regards,

Alexander

Hi @Euphi,

if “1” is written to memory address V2.6, then NI23 will change.

Kind regards,

Alexander

Yeah, but documentation states that

If observe is set and differ from block , binding will wait for value change on observe and send then a pulse with length pulse milliseconds to block.

However, this is obviosly not, what a Pulse thing really does.

@falkena Trying to reproduce your rollershutter example.
I saved your UDF to be compatible with Logo7.


RolladenMotor_L7.pdf (3.8 KB) Find the UDF attached. Rename pdf to zip!

In addition I included an emergency-stop flag - hoping this is at the optimal position to keep the UDF intact. The 3rd input is connected to a magnetic door-switch which is normally-ON (input is ‘high’ when door is closed).

Works in Logo, but so far does not work in openHAB:

  • Could you provide the corresponding sitemap-config?
  • How to determine the scaling-factor (?) T_Sc?
  • I can read the memory value (0=up…100=down), counting is optimal for 1 direction only.

Logo7 does not support reading NI (network inputs) directly, this might be a problem?

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

Or can I replaces this with:

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

(Pulse thing is still a bit mysterious to me).

Thanks,
Arnd

FYI, I have updated the 2 PLCLogo tutorials, these are fool-proof now (or mention issues).

@falkena, could you provide the sitemap for your rollershutter example?
Apologies, had no time to check your latest binding update (with pulse fixes).

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