Modbus TCP configuration switches

Hi all, I have a question related to the modbus TCP integration home assistant.
I have Relay Board PLC from aliexpress Relay Board PLC RS485
And i can control switch via modbus poll like:
open 01 06 00 01 01 00
close 01 06 00 01 02 00
where slave id: 01
function code: 06
channel number: 00 01
command: 01 00 or 02 00

But I couldn’t connect to Relay via Home Assistant.

modbus:    
type: tcp    
host: 192.168.20.60    
port: 502    

- platform: modbus    
  registers:    
  - name: Register1MB    
    slave: 0    
    register: 1    
    command_on: 1    
    command_off: 2    
 - name: Register3    
   slave: 1    
   register: 2    
   command_on: 1    
   command_off: 2     

Can anybody help?
And how to debug modbus?

homeassistant.components.modbus: debug    

Doesn’t help.

I test coonect via modpool tool and get this.

linux_x86-64/modpoll -m enc -a1 -r4 -c1 -t4:hex 192.168.20.60
modpoll 3.6 - FieldTalk™ Modbus® Master Simulator
Copyright © 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.
Protocol configuration: Encapsulated RTU over TCP
Slave configuration…: address = 1, start reference = 4, count = 1
Communication…: 192.168.20.60, port 502, t/o 1.00 s, poll rate 1000 ms
Data type…: 16-bit register (hex), output (holding) register table
– Polling slave… (Ctrl-C to stop)
[4]: 0x0001

I read 4 register from slaveID:1. BUT it worked only with
-m enc Encapsulated Modbus RTU over TCP

Hi @Yury_Pavlovsky,

have you been able to control the relay via Home Assistant now?

No, it was a test. And I don’t use this relay now.

You need to read the Modbus docs and Modbus switch

The important part for you is that…A valid modbus Hub needs to be configured and you need to take a look at your syntax

modbus: 
     name: HubName   
     type: tcp    
     host: 192.168.20.60    
     port: 502    

- platform: modbus    
  coils:     
     - name: Register1MB 
       hub: HubName 
       slave: 0    
       register: 1    
       command_on: 1    
       command_off: 2