Integrate Siemens Logo (plclogo) in OpenHAB 2

openhab2
binding
siemens
Tags: #<Tag:0x00007fe057925880> #<Tag:0x00007fe057925678> #<Tag:0x00007fe057925420>

(Jacek Tomasiak) #264

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


(Alexander Falkenstern) #265

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


(Jacek Tomasiak) #266

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


(Alexander Falkenstern) #267

Hi @skazi,

thanks :slight_smile:

Kind regards,

Alexander


(Alexander Falkenstern) #268

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


(Ian Hubbertz) #269

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?


(Jacek Tomasiak) #270

@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?


(Jan Reitzer) #271

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!


(Alexander Falkenstern) #272

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


(Alexander Falkenstern) #273

Hi @skazi,

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

Kind regards,

Alexander


(Alexander Falkenstern) #274

Hi @Euphi,

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

Kind regards,

Alexander


(Ian Hubbertz) #275

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.


(tv-arnd) #276

@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


(tv-arnd) #277

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).


(Alexander Falkenstern) #278

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


(tv-arnd) #279

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) {

(Alexander Falkenstern) #280

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


(Alexander Falkenstern) #281

Hello everybody,

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

Kind regards,

Alexander