Modbus Binary Sensor cannnot read from Holding Register


I am trying to integrate a 32-channel digital input “N4DIM32” into my installation using a RS485-Ethernet gateway. I use it for magnetic (reed) contacts on my windows.

I can communicate with the 32-IN using other tools, which can use the “read holding register” (0x03) command.

But now, I tried to setup in HA:

 - name: window_contacts
   type: rtuovertcp
   port: 502
    - name: "Fenster 1"
      slave: 1
      address: 128
      device_class: window
      input_type: holding

This will fail. It won’t work with the proposed ‘coil’ or ‘discrete’
Invalid config for [modbus]: value must be one of ['coil', 'discrete_input'] for dictionary value @ data['modbus'][0]['binary_sensors'][0]['input_type']. Got 'holding'.

Then I tried to change over to ‘sensors’ instead of ‘binary_sensors’, as I got ‘holding’ there.
Now, it won’t accept my device_class “window” anymore.
Invalid config for [modbus]: expected SensorDeviceClass or one of [........] for dictionary value @ data['modbus'][0]['sensors'][0]['device_class']. Got 'window'.

If I use pymodbus directly, it works fine:

from pymodbus.client import ModbusTcpClient

client = ModbusTcpClient('',port=502)
result = client.read_holding_registers(slave=1,address=128,count=3) #Reading 3 registers at once
print(result.registers[0]) #"1" -> Window 1 (open)
print(result.registers[1]) #"0" -> Window 2 (closed)
print(result.registers[2]) #"0" -> Window 3 (closed)

What is the best way to get my values here.
(I can either read 32 separate registers, one for each input, or 2 16-bit registers that contain all 32 inputs.)

Created a patch for modbus: