Creating Modbus Configuration for a Siemens LOGO!

Hi There :slight_smile:

Until now, I have implemented my Siemens LOGO by using NodeRed and a NodeRed Component which establishes the connection to the LOGO.
This is working fine - but I want to change that setup, because I am trying to get rid of such ā€œmiddlewareā€ā€¦ where its possible.

So, I decided to connect HA directly with the Siemens LOGO, using Modbusā€¦
Andā€¦ since it is the first time for me doing ANYTHING with Modbus (ok, at least without having a custom_component that do all the ā€œhard workā€ - I am struggling a bit with this setup.

Soā€¦ what do I need:

The whole reason for having a Siemens LOGO is to controll a Terrarium.
This solution was designed way before I started with HomeAssistant at all, and - of course, these Terrariums should work without the need of another server and so onā€¦

OKā€¦ So, main Information I need at that point:

State of Light (binary sensor)
State of Heating (binary sensor)
State of Water-Pump (binary sensor)
current Temperature
current Humidity

Optional:
the configured time the light should go on and off
the configured time the heating should go on and off

So far, I was able to implement the binary sensors for the Lights, Heating, and watering - and also the temperature workingā€¦

Hereā€™s my current configuration:

modbus:
  - name: "Terrarium Oscar"
    type: tcp
    host: 192.***.***.***
    port: 503

    binary_sensors:
      - name: "Daylight"
        slave: 1
        address: 8193
        input_type: coil
        device_class: light
      - name: "Heating" ...
      - name: "Water" ...
      
    sensors:
      - name: "Temperatur"
        #slave: 1
        address: 529
        input_type: holding
        unit_of_measurement: Ā°C
        device_class: temperature
        state_class: measurement
        scan_interval: 30
        swap: word
        scale: 0.1
        precision: 2

      - name: "Humidity"
        #slave: 1
        address: 530
        input_type: holding
        unit_of_measurement: "%"
        device_class: humidity
        state_class: measurement
        scan_interval: 30
        swap: word
        scale: 0.01
        precision: 5

grafik

Hereā€™s the information from the LOGO Software:
grafik

Here, you can see that Temperature should be on AM2 (but I am getting the value with using Address 529)
And the humidity should be on AM1 ā€¦ but what address should I use here?
grafik

Anyway - In HomeAssistant, I only get the 0.0000 so, I guess, I am reading the wrong registerā€¦ ?

And this is the same, but with the working NodeRed in HomeAssistant:

Any support would really be appreciated :slight_smile:
Thanks a lot!

Try 528 often there is an off by 1 on modbus addressing

what a f******

Thanks :smiley:

btw: I hate ā€œoff by one errorsā€

Yeah, itā€™s a bit bizarre.

ā€œ Zero vs. One Based Numbering

The Modbus specification says ā€œRegisters are addressed starting at zero. Therefore input registers numbered 1-16 are addressed as 0-15.ā€ Unfortunately, that means a register documented with an address of 1221 (Frequency) must be requested by sending an address of 1220 (04C4 hex) to the WattNode. Most application software will automatically handle this subtraction, but if you are writing your own code or watching raw packet bytes, you need to be aware of this offset by one.ā€

yeah - I know the reason for such errorsā€¦ but havenā€™t thought that this could be the reason.
Honestly speaking - at least with the Address of the temperature being off by one - I SHOULD have recognized this ā€¦ :-/

[[ But why did it then work with the addresses 8193, 8194 and 8195 ? They arenā€™t off by oneā€¦ ]]

OK, but maybe another question:
Do you have an idea, how I can get the values from a Clock-Block in the LOGO?

Meaning here the timers when the Daylight / Heating should switch ON or OFF (and maybe, if it is summer or winter-time)
grafik

In the NodeRed, I can read these ā€¦
grafik

The Return value from NodeRed is (as far as I remember) an Integer, which needs to be calculated / converted thenā€¦

var asHex = parseInt(msg.payload).toString("16").padStart(4, "0");
var hh = asHex.substring(0, 2);
var mm = asHex.substring(2, 4);
msg.topic = "Daylight Sunrise"
msg.payload = `${hh}:${mm}`

probably I need to write this into a variable (V) which is Coil 1 - 6808 ā€¦ ?

Thatā€™s a good question, donā€™t know. Is node red reading it from modbus?

:slight_smile: Itā€™s getting too late.
Actually, I made the same mistake on the binary_sensors (but it was correct the first time - and changed it to the wrong address laterā€¦ did not recognize that, because the lights are currently all off [itā€™s nearly mid night here] ā€¦)

Time for getting some sleep :smiley:

and no - NodeRed is not using modbus here - as far as I know.

hallo
Bin Neu hier. Habe HA Installiert und mmi Siemens Logo zum Laufen gekriegt.
dank eurer Hilfe kann ich Siemens Logo auch Auslesen

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

modbus:

  • name: ā€œhub1ā€
    close_comm_on_error: true
    delay: 1
    timeout: 1
    type: tcp
    host: 192.168.178.46
    port: 502
    binary_sensors:
    • name: ā€œHeizstab 1ā€
      slave: 1
      address: 8201
      input_type: coil
      device_class: light
      scan_interval: 1

    • name: ā€œHeizstab 2ā€
      slave: 1
      address: 8200
      input_type: coil
      device_class: light
      scan_interval: 1

    • name: ā€œHeizstab 3ā€
      slave: 1
      address: 8199
      input_type: coil
      device_class: light
      scan_interval: 1
      sensors:

    • name: ā€œAussen Temperaturā€
      #slave: 1
      address: 31
      input_type: holding
      unit_of_measurement: Ā°C
      device_class: temperature
      state_class: measurement
      scan_interval: 30
      swap: word
      precision: 2

    • name: ā€œWassertemperaturā€
      #slave: 1
      address: 32
      input_type: holding
      unit_of_measurement: ā€œĀ°Cā€
      device_class: temperature
      state_class: measurement
      scan_interval: 30
      swap: word

Mƶchte jetzt vom Goodwe Inverter ā€œsensor.active_powerā€ Werte an Siemens Logo Senden.
Kann Jemand Helfen?
Danke

Hello, could you help me to configure the Logo in order to working via MODBUS instead of S7 via NODERED?

Greetings! Today i post my manual about siemens logo + HA on habr.com
Siemens LOGO, Home assistant, ŠøŠ»Šø Š¼Š¾Ń‘ Š²ŠøŠ“ŠµŠ½ŠøŠµ уŠ¼Š½Š¾Š³Š¾ Š“Š¾Š¼Š° / Š„Š°Š±Ń€

The newest HW release (8.4) has built in MQTT support : LOGO! Logic Module - Siemens Global
Has anybody had the chance to experiment with it ?
With integrated MQTT, this version seems like a natural HA fit ?