Modbus Switch


modbus 스위치 플랫폼을 사용하면 Modbus coils 또는 registers를 제어할 수 있습니다.

설정

설치에서 Modbus 스위치를 사용하려면 configuration.yaml 파일에 다음을 추가하십시오.

# Example configuration.yaml entry
switch:
  platform: modbus
  coils:
    - name: Switch1
      hub: hub1
      slave: 1
      coil: 13
    - name: Switch2
      slave: 2
      coil: 14
  registers:
    - name: Register1
      hub: hub1
      slave: 1
      register: 11
      command_on: 1
      command_off: 0

Configuration Variables

coils

(map)(Optional)

A list of relevant coils to read from/write to.

hub

(string)(Optional)

The name of the hub.

Default value:

default

slave

(integer)(Required)

The number of the slave (can be omitted for tcp and udp Modbus).

name

(string)(Required)

Name of the switch.

coil

(integer)(Required)

Coil number.

register

(map)(Optional)

A list of relevant registers to read from/write to.

hub_name

(string)(Optional)

The hub to use.

Default value:

default

slave

(integer)(Required)

The number of the slave (can be omitted for tcp and udp Modbus).

name

(string)(Required)

Name of the switch.

register

(integer)(Required)

Register number.

command_on

(integer)(Required)

Value to write to turn on the switch.

command_off

(integer)(Required)

Value to write to turn off the switch.

verify_state

(boolean)(Optional)

Define if is possible to readback the status of the switch.

Default value:

true

verify_register

(string)(Optional)

Register to readback.

Default value:

same as register

register_type

(string)(Optional)

Modbus register types are holding or input.

Default value:

holding

state_on

(integer)(Optional)

Register value when switch is on.

Default value:

same as command_on

state_off

(integer)(Optional)

Register value when switch is off.

Default value:

same as command_off

Platform options 설명서에 표시된 대로 스위치 상태 업데이트에 대한 기본 30 초 스캔 간격을 변경할 수 있습니다.

전체 설정 사례

스캔 간격이 10 초인 온도 센서의 예 :

switch:
  platform: modbus
  scan_interval: 10
  coils:
    - name: Switch1
      hub: hub1
      slave: 1
      coil: 13
    - name: Switch2
      hub: hub1
      slave: 2
      coil: 14