Modbus YAML programming

Hi all! I am new to YAML programming. I am planning to build a smart home system on RS485. I have already been able to add a relay board control of four relays. The Chinese board has 4 inputs and 4 relays and Modbus control. Now I am faced with the problem of polling the inputs of the board and the state of the relay. I don’t know how to integrate encodings into YAML to send requests to the relay module. The module description says:
Read the relay status Send: FF 01 00 00 00 08 28 12
Returns: FF 01 01 01 A1 AO
Remarks: Bit0–Bit7 of the 4th byte of the return frame, 0x01, represent relay 1–relay 8, 0 means off, and 1 means on.

Read optocoupler input status Send: FF 02 00 00 00 08 6C 12
Returns: FF 02 01 01 51 AO
Remarks: IN1–IN8 of the 4th byte of the return frame 0x01 represent the input signal of optocoupler 1 to optocoupler 8, 0 represents low level, and 1 represents high level

modbus: 
  - name: hubrelay
    type: serial
    method: rtu
    port: /dev/ttyUSB0
    baudrate: 9600
    stopbits: 1 
    bytesize: 8
    parity: N
    timeout: 1
    lights:
      - name: "light1"
        slave: 3
        address: 0
        write_type: coil        
      - name: "light2"
        slave: 3
        address: 1
        write_type: coil
      - name: "light3"
        slave: 3
        address: 2
        write_type: coil
      - name: "light4"
        slave: 3
        address: 3
        write_type: coil  

What commands or functions should I use to get this data? If possible, please provide an example of YAML code. Or is there an easier way to add Modbus relay bord ? Thanks.

This config works for me. Thanks. Also interested in DI and Analog inputs