Modbus - DWORD values?

Hi there :slight_smile:
I am trying to read some values from my Siemens LOGO via Modbus.

In particular, values from a block that is providing information on the runtime.
I know, that the LOGO is using DWORD - and I know what information the LOGO should provide…

In my case, I know what the sensor SHOULD provide…
The timer is set to 4000 hrs - and the LOGO will send the information in Minutes.
Meaning, 4000*60 => the expected value (at least for one of the sensors) should be 240000

But - I don’t get the correct information.
In my case, I am getting values like:

(when trying swap: word_byte)
Or even higher value when just using the swap: word

      - name: Betriebsstundenzähler (t1 - mi)
        unique_id: "t1_betriebsstundenzähler_mi"
        data_type: uint32
        address: 7
        input_type: holding
        scan_interval: 10
        swap: word_byte

Right now, I am totally stuck with this sensor - and I really want to solve that issue to get propper values…
because, I am almost certain that there is a way to solve that… I am just not able to see it … :frowning:

And without any swap? Or swap: word?

OK, I had to do some more changes :slight_smile: but now, it seems to work.

      - name: Betriebsstundenzähler (t1 - mn)
        unique_id: "t1_betriebsstundenzähler_mn"
        data_type: custom
        structure: ">L"
        address: 3
        count: 2
        input_type: holding
        scan_interval: 10

      - name: Betriebsstundenzähler (t1 - ot)
        unique_id: "t1_betriebsstundenzähler_ot"
        data_type: custom
        structure: ">L"
        address: 5
        count: 2
        input_type: holding
        scan_interval: 10

      - name: Betriebsstundenzähler (t1 - mi)
        unique_id: "t1_betriebsstundenzähler_mi"
        data_type: custom
        structure: ">L"
        address: 7
        count: 2
        input_type: holding
        scan_interval: 10

Changes required:

  • remove “swap” option
  • add data_type: custom
  • add structure: “>L” (unsigned Long)
  • add count: 2 (because DWord is using two address-blocks)

The output is now the amount of minutes…
MI → expected runtime of 4000 hrs (240 000 minutes)
MN → remaining runtime (3991 hrs, x minutes)
OT → current runtime (8 hrs, y minutes)

Now, I only need to define a template to show the values in such a format hrs:min
MI → 4000:00
MN → 3991:x
OT: → 8:y

but I guess, that should be not too difficult :slight_smile:

DONE:

  • Added: device_class: duration
  • Added: unit_of_measurement: min

grafik

      - name: Betriebsstundenzähler (t1 - mn)
        unique_id: "t1_betriebsstundenzähler_mn"
        data_type: custom
        structure: ">L"
        address: 3
        count: 2
        input_type: holding
        scan_interval: 10
        unit_of_measurement: min
        device_class: duration

      - name: Betriebsstundenzähler (t1 - ot)
        unique_id: "t1_betriebsstundenzähler_ot"
        data_type: custom
        structure: ">L"
        address: 5
        count: 2
        input_type: holding
        scan_interval: 10
        unit_of_measurement: min
        device_class: duration

      - name: Betriebsstundenzähler (t1 - mi)
        unique_id: "t1_betriebsstundenzähler_mi"
        data_type: custom
        structure: ">L"
        address: 7
        count: 2
        input_type: holding
        scan_interval: 10
        unit_of_measurement: min
        device_class: duration