Home Assistant and Siemens LOGO! for complete house automation

Introduction:

I will be refurbishing an old house. The electrical installation will be completely redone. This is the opportunity to create the automation I want and integrate it with Home Assistant.

I have a lot of ESPHome devices in my current house (heater, ventilation, rain water, community water, water softener, security alarm, lights, …), and many other integrations (Solar, EVSE, cars, …). Integrating the lights in an existing installation with HA in a way that is transparent to the user, works when HA is down and is easy the reverse when moving out is the most tedious.

For the new place I will run all the lights with Siemens LOGO! PLCs and interface those PLCs with HA. That is what this thread is about.

It is important that everything will work when HA is down. The only difference the user will immediately experience is the use of push buttons to toggle the lights rather than conventional on/off switches.

The basic setup:

I will have a PLC on the main distribution board and on each of a few (TBD) secondary distribution boards. All light points will be wired directly to the distribution boards (for connection to the PLC relays). All push buttons will have low voltage wiring to the distribution boards (for connection to the PLC digital inputs).

I have chosen to use the Modbus not the MQTT integration to interface the LOGO! PLCs with HA.

Getting connected:

I have an old “LOGO! Soft Comfort” (version 6.?) software on a CD. I was able to upgrade that to version 8.4 for use with the new networked LOGO! PLCs. And I purchased a LOGO!12/24RCE (6ED1052-1MD08-0BA2) to get started.

I found a video explaining how to connect the LOGO! to the PC.

Note:
This was the first time ever I had to set up an IP address, the mask and the gateway for a LAN connection. That threw me off for a second, but with this video it was straight forward.

And a video explaining the basic LOGO! block diagram and HA yaml code needed:

Note:
In this video I got stuck around the 3:20 mark. The data table in the video immediately shows up populated, but the first time you have to do that yourself by adding the network interfaces (V0.0, …) in the first column! My search found others getting stuck here, but no answers. Here it is, you are welcome.

This got me connected. And now I am trying different options for how the LOGO! and HA are going to work together.

LOGO! and HA

Each PLC output (light) will be defined with a pulse relay. The pulse relays can be toggled from a PLC input (button) to switch the lights.

From HA I want to be able to toggle, set or reset the pulse relays. Each of these actions require a pulse (on the T, S or R input of the pulse relay). So I created an input (with debounce) to connect to a button and three network inputs to toggle, set or reset the relay:

The network inputs will be connected to a switch in HA. There is a switch action to ‘switch on’, ‘switch off’ or to ‘toggle’ a switch in HA, but none to generate a pulse (maybe there should be?). So I explored simply toggling the switch and have the PLC generate the pulses like this:

But then decided that creating the pulse in HA seemed less of a work-around. So I created a script for each switch to generate a pulse.

#
# *** SIEMENS LOGO! PACKAGE ***
#

# Modbus definition

modbus:
  - name: "LOGO"
    type: tcp
    host: 192.168.178.200
    port: 502
    delay: 5
    timeout: 2


# SWITCHES

    switches:

      - name: Switch_10
        address: 8 # V1.0
        write_type: coil
        command_on: 1
        command_off: 0

      - name: Switch_11
        address: 9 # V1.1
        write_type: coil
        command_on: 1
        command_off: 0

      - name: Switch_12
        address: 10 # V1.2
        write_type: coil
        command_on: 1
        command_off: 0


# BINARY SENSORS

    binary_sensors:
    
    # Output Q1
      - name: Q1
        address: 8192
        input_type: coil
        scan_interval: 1
        unique_id: E8A2B3B0D5


# SCRIPTS

script:

    # Create pulse outputs for the LOGO! network inputs

    pulse_v10:
        alias: Pulse V1.0
        sequence:
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_10
          - action: switch.turn_on
            target:
              entity_id:
                - switch.switch_10
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 500
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_10

        pulse_v11:
        alias: Pulse V1.1
        sequence:
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_11
          - action: switch.turn_on
            target:
              entity_id:
                - switch.switch_11
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 500
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_11

    pulse_v12:
        alias: Pulse V1.2
        sequence:
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_12
          - action: switch.turn_on
            target:
              entity_id:
                - switch.switch_12
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 500
          - action: switch.turn_off
            target:
              entity_id:
                - switch.switch_12


# END

Hello VdR, Sorry I am unable to answer your question. As a relative newbie approaching a first fix for my house may I ask you a question: why did you choose to use the Seimens system?

I want a dedicated system to run the ‘necessities’ (like lights) independently. The ‘nice to have’ can rely on a RPi running HA.

I have experience with the Siemens system, I use it in my current house to control the lights outside (security and garden).

It is industrial (reliable, well supported) hardware.

It’s not too expensive.

It’s DIN rail mounted for easy integration in the electrical system.

It is easy to program with a graphical block editor and through the network connection.

It now has ways to interface with Home Assistant (Modbus or MQTT).

I’m a nerd.

I have many questions but don’t want to derail your thread. Hope you get a solution.