| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- from __future__ import annotations
- from .base import ProtocolSpec
- MODBUS_POINT_TYPE_ALIASES = {
- "bool": "bool",
- "boolean": "bool",
- "BOOL": "bool",
- "short": "int16",
- "SHORT": "int16",
- "int16": "int16",
- "INT16": "int16",
- "word": "uint16",
- "WORD": "uint16",
- "uint16": "uint16",
- "UINT16": "uint16",
- "long": "int32",
- "LONG": "int32",
- "int32": "int32",
- "INT32": "int32",
- "dword": "uint32",
- "DWORD": "uint32",
- "uint32": "uint32",
- "UINT32": "uint32",
- "float": "float32",
- "FLOAT": "float32",
- "real": "float32",
- "REAL": "float32",
- "float32": "float32",
- "FLOAT32": "float32",
- "double": "float64",
- "DOUBLE": "float64",
- "float64": "float64",
- "FLOAT64": "float64",
- "longlong": "int64",
- "LONGLONG": "int64",
- "int64": "int64",
- "INT64": "int64",
- "qword": "uint64",
- "QWORD": "uint64",
- "uint64": "uint64",
- "UINT64": "uint64",
- }
- MODBUS_REGISTER_TYPE_ALIASES = {
- "coil": 1,
- "coils": 1,
- "read_coils": 1,
- "线圈": 1,
- "discrete_input": 2,
- "discrete_inputs": 2,
- "read_discrete_inputs": 2,
- "离散输入": 2,
- "holding_register": 3,
- "holding_registers": 3,
- "read_holding_registers": 3,
- "保持寄存器": 3,
- "input_register": 4,
- "input_registers": 4,
- "read_input_registers": 4,
- "输入寄存器": 4,
- }
- MODBUS_SPEC = ProtocolSpec(
- protocol="modbus",
- create_device_path="/api/collector/device",
- create_point_path="/api/collector/modbus/point/add_collect_point",
- point_test_path="/api/dc-gateway/modbus/read_points",
- device_defaults={
- "type": "modbus",
- "timeout": 3,
- "is_persistent": True,
- "group_id": 0,
- "alarm_interval": 90,
- "collect_interval": 5,
- "retry_times": 0,
- },
- point_defaults={
- "scale_ratio": 1,
- "value_offset": 0,
- "group_id": 0,
- "invalid_values": "",
- "valid_range_start": None,
- "valid_range_end": None,
- "bit": 0,
- },
- )
|