Integrate Siemens Logo (plclogo) in OpenHAB 2

Hi @The_Source,

thanks :slight_smile: Welcome in the Logo-Gang :slight_smile: :slight_smile:

About your question: I canā€™t get your use case. I - Inputs are physical inputs, connected to physical push-buttons/switches. Do you try to activate proxy-switch, if button was pressed? Additionally, the reaction speed, depends on bridge refresh parameter. The higher refresh time is, the longer time it may take rule will fire. But updates are more robust aganst instable network connections. Smaller refresh time will result in quicker response. But, if your network connection is not very stable (for example wireless) updates may fail.

Kind regards,

Alexander

Hey @falkena,

no I donā€™t want to activate the Input, I just want to watch the current state.
It works for Outputs but I donā€™t get it to work for Inputs.

I need this because I have a hardware-switch and I need to know if it is activated and the only real solution is to use the Input-state for that.

Greetz,
Source

Hi @The_Source,

ok. Iā€™ll try to reproduce your finding. Sadly, Iā€™ve disassebled my test setup a week ago. It will take some days to wire it again. Can you please, check, if there is any output in events.log? Can you find any state changes on Contact item, if button is pressed?

Kind regards,

Alexander

Hi @falkena,

thanks for the hint witrh the event.log, donā€™t know why I didnā€™t check that before. So I have to check for the states ā€œOPENā€ and ā€œCLOSEDā€ and not ā€œONā€ and ā€œOFFā€ so it is working now :smiley:

thanks for your help!

Greetz
Source

Hi @The_Source,

Cool :slight_smile: I didnā€™t saw the error from your rule above tooā€¦
Nevertheless, i must wire my test environment againā€¦

Kind regards,

Alexander

Hi Alexander

I had some time this afternoon for making the tests you suggested:

but before I did this, I upgraded my OH2 (now running on a Rasperry) to the latest, stable version. I was very happy to see that the PLC-Logo binding is now also available on paperUI - thank you so much for this great piece of work.

However, the result of my todays test is annoying. Iā€™m still not able to get data from OH2 to Logo. NI-states do NOT change in online simulation.
In a slightly modiefied PLC-program, where I can toggle the PLCs output Q1 by the use of a pysical pushbutton connected to I1, Iā€™m was at least able to get the status of Q1 displayed in OH2.
Ping result is 15ms avg.
Giving up ;(

Could ā€œPowerlineā€ (Ethernet via power net, less than 50 meter but RCDs in between) be the problem? Even though ping shows normal results?

Hi @wita01,

good. Communication seems to work. Ping looks good. Can you send me please, your test logo program and Logo-Related openhab configuration(things and items) via PM? Try you to configure Logo via PaperUI?

Kind regards,

Alexander

Hi,

I am new at openhab, but am discovering new things every day.:smile:
At the moment I am running openhab on a raspberry pi3B and it runs smoothly.
I installed the PLClogo-binding and my logo 8 FS4 is connected and online.
Via online simulation in softcomfort I can test the NIā€™s via VB-memory.

I just keep having problems with the pulse-blocks. I want to use the switch as a pulse button, the output Q1 is then switched on and off via a pulse relay in logo softcomfort with every pulse of the pushbuttong.
Therefore I configured VB0.1 as switch state and Q1 as observed. (copied the code stated in higher posts)
I would think that there is a pulse with every press on switch VB0.1 on paper UI, and that the state of the switch on paper UI reflects the state of Q1?
When I press the switch VB0.1 in paper UI output Q1 is being set to ā€˜1ā€™, but the state of the switch in paper UI is going back to off, while the state of Q1 is ā€˜ONā€™.
After this I press the switch again and Q1 toggles back to OFF, but the state of the switch on paper UI stays ON.
Also VB0.0 stays on and behaves like a switch instead of a pulse switch.
To set the output Q1 again after this I have to click the switch VB0.1 to OFF and then back to ā€˜ONā€™ to get Q1 back to ON.

image

When I link VB0.1 to both state and observe channel, the switch does act like a pushbutton that gives a pulse.
But then I donā€™t get the state of the output Q1 in PAPER UI.

Am I doing something wrong, or do I have a wrong understanding of the pulse thing?

Kind regards,
Brecht.

Hi @Brecht,

the theorie of operation for pulse-things is follow:

  1. if ā€œblockā€ and ā€œobserveā€ parameters are equals, then pulse with ā€œpulseā€ milliseconds will be send to ā€œblockā€.
  2. if ā€œblockā€ and ā€œobserveā€ are different, then binding will wait for change on ā€œobserveā€ and then send pulse with ā€œpulseā€ milliseconds to ā€œblockā€

For both use cases: if ā€œblockā€ was 0 then 1 is send and vice versa. Please note, that PaperUI is not really stable with pulse-things: Integrate Siemens Logo (plclogo) in OpenHAB 2 and Integrate Siemens Logo (plclogo) in OpenHAB 2

See here for additonal information. I just realised, that documentation for pulse thing must be improvedā€¦

Kind regards,

Alexander

Hi @falkena

I am new to openHAB, too and trying around with the plcLogo integration.
I am able to switch a light over the BasicGUI with the pulse thing as mentioned in the release note on your github (block=VB0.1, observe=NI1)

But sometimes I have problems with this feature:

Normally the pulse shall go 0-1, but sometimes the pulse sticks on 1 and after that it pulses 1-0. Then I canā€™t switch off the light and it blocks my wall-mounted switch.
What could be the reason for that? Or would it be a option to add config-option to the pulse thing to set the direction it shall pulse (rising, falling, either)?

Thanks for your work!
Daniel

Hi @nickd,

try to increase pulse length: we try to work with hard real time system from java application :slight_smile: My configuration use 100ms as polling intervall (bridge ā€œrefreshā€ parameter) and ā€œpulseā€ is set to 500ms. May itā€™s really better to introduce new parameter to the thing: ā€œcloserā€ for pulses 0->1 and ā€œopenerā€ for pulses 1->0. Means: ā€œcloserā€ assumes, that initial state was 0, send 1 and then after timeout send again 0. ā€œopenerā€ works opposite way. Default value for parameter is ā€œcloserā€

Kind regards,

Alexander.

Hi @falkena, hi everybody,

I started with a new Openhab installation that will connect to several Logos - mostly to switch Light or Power.

The PLCLogo-Binding worked out of the box for me. The Logo (for now it is only one Test device) was auto-detected and it was straight-forward to add things for Input and Output channels.
So, many thanks for such a nice binding :blush: !

  • However, it took us some time to establish the connection. Problem was a missing S7 connection in the Logo configuration. The documentation should give a short hint, how to create the connection with LogoSoft Comfort.

Now I think about the interface specification between Logo and Openhab and have several questions about the Binding (or maybe the Logo itself?):

  • What exactly is a pulse thing? After reading the bindingā€™s documentation and this thread, I still donā€™t get it. It seems that this is a way to generate a Pulse if some other Variable (Block) has changed.

  • Why do I need to add one thing per ā€œobservedā€ item? For me it seems more useful, to have on ā€œPulse Thingā€ and configure the blocks with channel configuration? (As for inputs and outputs)

  • Why Inputs needs to be of type ā€œContactā€. This seems wrong to me. It should be possible to configure them as Switch, too. This is especially true for NI, because an NI can be used as output from Openhab. So, usually I want to link a Switch item to it.

  • When you add a Digital Thing with PaperUI, only 20 Channels are created, but there are 64 available for NI, NQ or M? Is there a way to add theses channels in PaperUI?

Thanks @falkena for the great binding.
I am now working with the merged version from the openHAB 2.4 on RaspberryPI.
There were many contributions for practical solutions above - thanks as well. This thread becomes quite overloaded, imho. I think we should create a new forum thread to collect solutions that are complete and 100% work (fool-proof).

One post in that thread contains one solution? Or like the ā€œDesign Patternā€ (one topic per solution)? Tagged with [Tutorials & Examples] [Solutions] [Bindings]

This should be editable (for revision) by all, if possible? Alternatively feedback from replies is incorporated into the 1st post (by the author of thread).
Should contain some structure, e.g. Problem Statement, Concept, Example, a screenshot of what you get (sitemap screenshot), openHAB version, zip-file with all openhab-config files and maybe Logo-config (Logo soft comfort file or screenshot of the Diagram-Editor. Drawback: This forum does not permit zip-file uploads, therefore all config must be placed as code fences in the post.

What do you think?

I wish we could get properly consolidated examples for:

  • rolloshutters
  • lights (switch + status indicator)
  • timer configuration (setting logo clock parametersā€¦more in a later post)
  • ā€¦

Here an example as template.

Thread-name PLCLogo Solution: Logo Input Monitoring

Problem Statement

How to obtain status of Logo-inputs for window/door alarm contacts?

Concept

Reading inputs of a Logo via openHAB PLCLogo binding and visualize their status (read-only) in a sitemap. Magnetic alarm contacts provide the open/closed status of a window or door. A closed alarm contact shall represent a closed window/door. Connect each alarm contact to a dedicated Logo-input. A sophisticated Logo configuration is not required because Logo-inputs are directly read by the PLCLogo binding.

This thread is a wiki article and can be improved by everyone. Please do!

Solution

Here is a screenshot of what the result look like.


(Screenshot contains modified icons, not included.)

LOGO! Configuration (LOGO! SoftComfort Diagram Editor)
OpenHAB_LogoPLC_alarmcontacts_Logo-config

Things (logo7.things)
In this example, the IP address 192.168.xxx.yyy represents the Logo deviceā€™s address and must be adapted.

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" ]
}

Items (logo7.items)

Contact Logo7_I1    "Fenster WC [MAP(contact_door_de.map):%s]"      <window> { channel="plclogo:digital:Logo7:Inputs:I1" }
Contact Logo7_I2    "HaustĆ¼r [MAP(contact_door_de.map):%s]"         <frontdoor>   { channel="plclogo:digital:Logo7:Inputs:I2" }
Contact Logo7_I3    "Fenster KĆ¼che [MAP(contact_door_de.map):%s]"   <window> { channel="plclogo:digital:Logo7:Inputs:I3" } 
Contact Logo7_I4    "Fenster Essen [MAP(contact_door_de.map):%s]"   <door> { channel="plclogo:digital:Logo7:Inputs:I4" }
Contact Logo7_I5    "Fenster Wohnen (links) [MAP(contact_door_de.map):%s]"  <door> { channel="plclogo:digital:Logo7:Inputs:I5" }
Contact Logo7_I6    "Fenster Wohnen (rechts) [MAP(contact_door_de.map):%s]" <door> { channel="plclogo:digital:Logo7:Inputs:I6" }

Transformation (contact_door_de.map)
Make sure you have the Map Transformation service installed in Add-ons / Transformations.

CLOSED=ZU
OPEN=OFFEN
NULL=undefiniert
-=Strich

Sitemap (default.sitemap)

sitemap default label="Haus" {
Frame label="Alarmkontakte" icon="groundfloor" {  // icon does not work
        Default item=Logo7_I1   valuecolor=[CLOSED="green", OPEN="red"]
        Default item=Logo7_I2   valuecolor=[CLOSED="green", OPEN="red"]
        Default item=Logo7_I3   valuecolor=[CLOSED="green", OPEN="red"]
        Default item=Logo7_I4   valuecolor=[CLOSED="green", OPEN="red"]
        Default item=Logo7_I5   valuecolor=[CLOSED="green", OPEN="red"] 
        Default item=Logo7_I6   valuecolor=[CLOSED="green", OPEN="red"]
    }
 }

Revision History

  • January 2019: original post for openHAB version 2.4 with Logo 0BA7

Troubleshooting

  • nothing so far

Next Ideas

  • none so far

Arnd

1 Like

I can turn the post into a wiki if desired. Just tag me with @ and Iā€™ll do it when you are ready.

Or open a github repo to put it into.

Also look at the InfluxDB+Grafana Tutorial and MQTT 101 tutorial for some good examples of how to structure a tutorial like this.

Hi @Euphi,

thanks :slight_smile: Iā€™ll try to answer your questions:

Well, the procedure is well described in manual to LogoSoftComfort: simply search for ā€œnetwork projectā€ and/or ā€œethernet connectionsā€. An Pull-Request with updated documentation is also welcome.

Iā€™ve added some lines to documentation

Well, letā€™s take a look into manual to LogoSoftComfort again: Logo can address 851 bytes (range 0 - 850). Each byte contains 8 bits. Means: we will have a thing with 6808 channels. Itā€™s really huge thing:-)

See here for explanation

Again, manual to LogoSoftComfort will help us. Siemens online documentation is helpful too. Just for info: Siemens has increased number of digital outputs to 20 (yeah, itā€™s really huge) in Logo!8 compared with 16 in Logo!7.

Kind regards,

Alexander

Problem for me was that a network project still requires that the actual connection is setup as normal ethernet connection. It is not sufficient to create the connection in the ā€œNetwork Projectā€ only. While this is clearly an issue of the LogoSoft Comfort documentation, the process to set and see the TSAP configuration could be explained better in the binding documentation. When I find some time, Iā€™ll create a PR.

Where? Is it already available?

Yes, but if you want to make use of them, you will have 851 Things?!

Yeah, but there are 64 Network Inputs and 64 Network Outputs? But also for an NQ-Thing ā€œonlyā€ 20 Channels are created. Is it possible to create all 64? (Without need to configure them manually)?

Explanations like these are why a think that Contact is wrong. A network input of the Logo can be the output of Openhab, so it should be possible to configure it as Switch.

No, in worst case iā€™ll have 6808 things :slight_smile: In base case no one. Your suggestion creates always 6808 channels.

Sorry, i canā€™t reproduce the error:
grafik

If you find a way how to modify network inputs directly without mapping to memory, tell me, please. Iā€™m very interested on the solution.

Kind regards,

Alexander

@rlkoshak
Thanks for your advice.
I have created a new thread for the solution above.

Please make it a wiki article.

done. it should be a wiki now. thanks for posting!

@falkena
I think we need a pulse-thing, with opener/closer behaviour, i.e. that assures a retun to 0.
Sometimes I have a sticky NI (network input) that behaves somehow inverted.