Hi all,
It’s a long time since I wrote something on that topic… ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=10)
Back then, I had my LOGO integrated with NodeRed - which was working fine so far … the reason behind that was, that I had no Idea on how to work with Modbus - and also, I did not really had the time to dig into that “rabbit hole” then.
So, using NodeRed and a contribution that enabled the communication with the LOGO was the easiest way to go with…
But - things are changing, and nowadays, I have to improve my Modbus Skills, because there are plans to buy some Hardware for which the only way of integrating it into HA will probably be Modbus.
So - I am using the time and move my whole LOGO programming to be able to work with HomeAssistant over Modbus.
It was a bit of a way to get (nearly) everything working in a way I wanted - but finally, I am only a few small footsteps away of having ALL relevant information in HA - and also, I can controll some of the parts of my LOGO…
I can now read the temperature information, the humidity - I can switch on the Daylight lamp and the heating lamp and also the humidifyer - in addition to that, I can now read the values of my automation-clock (that turns on the lights when sunrise and sunset timings have been reached.
The last step I want to accomplish is to read the values of a Block which measures the operating hours of my heating lamp.
The problem here is:
The “Sunrise” and “Sunset” information are WORD type - and that’s what I can use in HomeAssistant:
modbus:
- name: Sonnenuntergang (t1)
unique_id: "t1_sunset"
address: 2
input_type: holding
scan_interval: 10
swap: word
template:
- sensor:
- name: Sonnenuntergang
unique_id: "t1_sunset_timestamp"
device_class: timestamp
state: >
{% set x = ('%04x' % states('sensor.sonnenuntergang_t1')|int(0)) %}
{{ today_at('%s:%s' % (x[:2],x[-2:])) }}
But - the operating time will be delivered as DWORD value…
And I haven’t found an information on how to use this…
usning “swap: word” seems to provide wrong values… and according to the documentation, I can only use word or word_byte
swap string (Optional, default: none)
Swap the order of bytes/words, options are none
, byte
, word
, word_byte
.
And this is the information the LOGO does provide, when I am using these information on the Display:
![grafik](https://community-assets.home-assistant.io/original/4X/d/3/2/d322ae6d2b3d43a72acd24476d3e9c8e14914983.png)
MI → expected (the device needs to be replaced after this run time)
OT → how long does it run?
MN → how much time is remaining (the block will be set to high if this goes to 0)
EDIT:
I’ve tried to use Data_type: uint32, swap: word
- name: Betriebsstundenzähler (t1 - mn)
unique_id: "t1_betriebsstundenzähler_mn"
data_type: uint32
address: 3
input_type: holding
scan_interval: 10
swap: word
- name: Betriebsstundenzähler (t1 - ot)
unique_id: "t1_betriebsstundenzähler_ot"
data_type: uint32
address: 5
input_type: holding
scan_interval: 10
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
which seems to provide an output that COULD be a correct value…
the question now is, how to convert this into a human readable information… ![:smiley: :smiley:](https://community.home-assistant.io/images/emoji/twitter/smiley.png?v=10)