Siemens logo 8

Hi, i’m pretty new to hass, but i see a lot of possibilities. I’ve installed hass.io on a RPI3 and everything works fine.
Now i want to communicate with a siemens Logo! 8. anyone has experience with that?
I’ve found a phyton snippit on Github to do this.

https://github.com/sinty/Siemens-LOGO-smart-home

Unfortunately it don’t work. any clues what i do wrong?

  1. installed the MQTT broker (works fine, tested via developer tools)
  2. created a “phyton_scrips” directory in config directory and pasted the adapted code from github
  3. changed my configuration.yaml

unfortunately, nothing happens. i have no idea how to begin debugging.

a big thank you!

5 Likes

Hi

Have some Logo! controllers, have HA but still wonder, why would you need Logo beside HA ? What simple PLC can do better than full blown HomeAssistant ???

1 Like

Hi there!
I am also building my system using Siemens LOGO 8 modules.
I did try to use HA modbus component but it did not work out for me.

Then I found that there is kind of easy solution using Node-RED. Just use this node - https://flows.nodered.org/node/node-red-contrib-s7
Also use this flow - https://flows.nodered.org/flow/272a6d2104474c68f7b0e01bae025ead
Then use MQTT for communication with HA.
I still did not figure out how to use it with HA nodes. Maybe there are people that could help?

1 Like

hi, thank you very much for the info. at this time, honestly, it sounds rather complicated, but i will start studying node-red i’ll keep you posted Thanks again for the feedback!

No problem. It is quite little info on siemens logo and ha. I am a beginner too, but nodered-mqtt-ha combination works for me.

thanks. i’ll set up a raspberry with node-red this week. then i wil lfollow the guide i suppose :slight_smile:

No need in raspberry pi. Just create virtual machine using oracle virtualbox. Install hass.io. And just add nodered as integration.

1 Like

hi, thanks a thousand times for your help. i’ve documented my setup and will put it online once it works to help maybe others…unfortunately at the end i’m still blocked :slight_smile: :frowning:

i’ve installed node-red, imported the S7, made the link between logo and node-red and have a green and online logo in node-red. now i’m adapting the vm mapping to read the entries, but i’m a bit confused. how can i read the status of an output? only thin i see in the dropdown box are a lot of relay blocks. what do i miss?

a big big thank you for your help!

logo_cap_1
logo_cap_2

1 Like

Hi,
if you have a newer Logo that supports Modbus TCP you can intagrate it into HA directly. In theory that is. I am getting my Logo next week and i’ll try to integrate it using Modbus TCP and report back.

Tomaz

2 Likes

Hello, I finally received my Logos. And it is very easy to set up a modbus connection to the Logo from HA. And it is very easy to communicate via Modbus.

  1. LOGO Setup
    a) Setup LOGO as Modbus server in LOGO!Soft Control
  • Tools -> Ethernet Connections…
  • Enter IP address of your LOGO…
  • Right click on Etnernet Connections -> Add server connection -> Modbus Connection
  • Upload your program to LOGO (empty program works great!)
  1. HA Configuration Example
modbus:
  name: hub1
  type: tcp
  host: 192.168.0.210
  port: 502
  
switch:
  - platform: modbus
    scan_interval: 10
    coils:
      - name: Switch1
        hub: hub1
        slave: 1
        coil: 8192
      - name: Switch2
        hub: hub1
        slave: 1
        coil: 8193
      - name: Switch3
        hub: hub1
        slave: 1
        coil: 8194

This will setup three switches to directly control first thee outputs on LOGO.
Note:

  • If you want to control the output direclty from HA you can’t use the same output in your program.
  • Logo has to be in RUN mode for this to work.

You can find all the Modbus Addresses in Properties (Alt+Enter), but you have to substract 1 from all the addresses. If you wan’t to control an output from program in the LOGO and HA you have to communicate via Variables and not with the Outputs directly. I have to iron out problems with the loop that is created if you use the same Varible as Network input and Network output in LOGO program.

3 Likes

Hi!

Do you have any update about this?

I’m building a new house and I’m thinking about the following method of elektricity:

  • Push buttons and a Siemens Logo
  • Using Home Assistant to operate with my smartphone

Is this a good idea?

1 Like

Hi!
My answer is yes and no. Siemens Logo can be used for this purpose but in this case there is no “manual ovveride”.
In my system I have a combination of Siemens Logo and Denkovi SmartDEN IP-16R (https://denkovi.com/smartden-lan-ethernet-16-relay-module-din-rail-box). I use Denkovi for switching/toggling lights and Logo (230V version) for controlling window shades and as sensors for lights.

For lights I wanted a system that can me manualy operated even if the automation is not working (broken). And you can not achieve that with the Logo as its relays only have 2 contacts (C/NO). For this to work you have to have relays with 3 contacts (C/NC/NO).

I wired EVERY switch directly to the switchbox and instead of 1-way switches all switches in my system are 2-way or intermediate switches and a relay with 3 contacts also serves as 2-way switch. The only downside to this approach is that you need “a little” more wiring and a huge fusebox (or in my case 3 fuseboxes) that contains the controllers and all the connections. But the main advantage is that when i’ll be 99 years old and don’t want to bother with tinkering the system will still work (at least manualy) even if the controlers fail. But the problem in this system is that you can only toggle the lights (you can’t know the state of the lights). That’s why i use the Logo (230V version) as a sensor if the lights are on or off, so I can see the status in HA and tell HA to turn on or off the lights.

I have 90% of lights controlled in the above manner. 3 lights controlled with Logo (kitchen cabinet lights and toilet light) and 3 lights that are not integrated in the system (desk lamps).

But with 99% of home automations out there you can’t turn on/off the lights if the controler fails. So using just Logo is OK if you are ok with this.

With Logo (230V version) you also get the benefit of using regular 230V for control lines that are less prone to interference in the long lines that low voltage control lines.

If you do use Logo for lights control it is best that you set up the basic logic for turning on/off in the Logo itself so it still works via pushbutton if you HA is down.But in this case you have to use variables to communicate with HA.

2 Likes

Thank you so much for your information!

If I use variables to communicate with HA, as you told me.
Can I read and change the current state then? So will my HA change the current state, when I use the push button?

In theory yes. I did some tests and it did work.

I am working on window shades control this week. I plan to implement a solution where I can control the shades (up/down, open/close) from HA and also read the state of the shade from the Logo. Yesterday I finished the Logo program so it now works without integration with HA. I plan to work on the communication part of the Logo programm this week. I’ll be able to better answer the questions in a few days.

Right now I don’t have a good solution for “mission critical” communication between HA and Logo as HA is pooling the Logo. You need to programm the basic functionality in Logo (turning the light on/off when the button is pressed). Because when you press the button it may take a second or two (or more if you define it so) before HA is aware that you pushed the button. So it’s best that you use HA to only programm the advanced logic (remote control, time scheduled switching,…)

In the meantime, have you found a way to communicate in mqtt? Thank you!

Now just setup the node to read the network input or output from logo and connect it with HA using mqttt node. In HA create a mqtt switch or other mqtt entity. That is what I did.

But now I figured out how to use modbus and it works fine. I do not have to use nodered and mqtt anymore for this.

What I did is I used modbus and template switch.
In HA create modbus connection with 2 coils. One coil is connected with network input of logo which controls the output. Another coil is connected with network output in logo which reads the state of the output (see image below, but take into account that I am using push uttons so the signal goes through pulse relay)
Create template switch that uses state coil as sensor and control coil as switch. Set the switch to toggle state (in my case I created a script that generates a short pulse of signal each time you toggle the template switch)

Now if you enable light manually it will be updated in HA

1 Like

I have been able to use your setup and applied it to the analog inputs.

Firs I added a sensor NAQ2 and its VW address 102 to my setup as can be seen in the image below.

image

From there I looked up the correspondence of VW to it’s register with the following table, I didn’t make this, the credit to the maker. The register is the address divided by 2.

In my case 102 correspond to 51. With the snippet below you are able to get the output value from the Logo.

sensor:
  - platform: modbus
    scan_interval: 1
    registers:
      - name: SensorLivingRoom
        hub: hub1
        slave: 1
        register: 51

Controlling the dimmer is done with the following code. The address is 50 as my logo has a network anlalog input with an address of 100.

- platform: template
    lights:
      living_room:
        friendly_name: "Living Room"
        level_template: >
          {% if (states('sensor.sensorlivingroom') | int) == 0 %}
            {{ (states('sensor.sensorlivingroom') | int) }}
          {% else %}
            {{ ((states('sensor.sensorlivingroom') | int ) * 255 / 100) | round(0) }}
          {% endif %}
        value_template: "{{ states('sensor.sensorlivingroom') | int > 0 }}"
        turn_on:
          - service: modbus.write_register
            data:
              hub: hub1
              unit: 1
              address: 50
              value: 50
        turn_off:
          - service: modbus.write_register
            data:
              hub: hub1
              unit: 1
              address: 50
              value: 0
        set_level:
          - service: modbus.write_register
            data:
              hub: hub1
              unit: 1
              address: 50
            data_template:
              value: "{{ ((brightness | float / 255) * 100)  | int }}"

It took me some time to get it working but now it is working like a charm. I can change the light intensity from HA or my physical switches and there is no way of knowing that either has been used. It’s seamless.

Hope this can help trying to do the same.

4 Likes

I would like to know how you control the dimmer itself. What is the wiring? Which led driver do you use? Do you use analog output from the logo to control it? What type of sensor do you use?

The wiring is pretty straight forward, I use a digital in to control the dimmer and an analog out for the light. The output drives a niko dimmer this is the one I use : https://www.niko.eu/en/article/330-00701 (you can also do this with 2 modules from eltako SUD12 and LUD12, it is cheaper). On a side note, I would have loved the logo to have a PWM of 100Hz than I could have used a digital out instead of an analog output and would have been way cheaper. Bud sadfally it is what it is.

As I am controlling indoor lighting the sensor is my eye and AQ sent to HA and it can be trusted.

How to control a dimmer with one DI and one AQ can be found in the documentation from siemens very well explained (section 4.2 is where you can find the schematics) : https://cache.industry.siemens.com/dl/files/085/109739085/att_909111/v6/109739085_dimming_with_logo_DOCU_v10_en.pdf

From there I added 2 things:

  • being able to control with HA that is the bottom part of my schematic
  • stop the dimmer to change value when it reaches the max or the min

It isn’t perfect some things need to be cleaned especially the scale but it works. I don’t know where to upload my file so here is a picture my dimmer controller.

I hope this help.

1 Like