[ { "label": "ModbusTcpClient", "importPath": "pymodbus.client", "description": "pymodbus.client", "isExtraImport": true, "detail": "pymodbus.client", "documentation": {} }, { "label": "Endian", "importPath": "pymodbus.constants", "description": "pymodbus.constants", "isExtraImport": true, "detail": "pymodbus.constants", "documentation": {} }, { "label": "Endian", "importPath": "pymodbus.constants", "description": "pymodbus.constants", "isExtraImport": true, "detail": "pymodbus.constants", "documentation": {} }, { "label": "BinaryPayloadDecoder", "importPath": "pymodbus.payload", "description": "pymodbus.payload", "isExtraImport": true, "detail": "pymodbus.payload", "documentation": {} }, { "label": "BinaryPayloadDecoder", "importPath": "pymodbus.payload", "description": "pymodbus.payload", "isExtraImport": true, "detail": "pymodbus.payload", "documentation": {} }, { "label": "ModbusClient", "importPath": "pyModbusTCP.client", "description": "pyModbusTCP.client", "isExtraImport": true, "detail": "pyModbusTCP.client", "documentation": {} }, { "label": "ModbusTcpServer", "importPath": "pymodbus.server", "description": "pymodbus.server", "isExtraImport": true, "detail": "pymodbus.server", "documentation": {} }, { "label": "MODBUS_SERVER_PORT", "importPath": "client", "description": "client", "isExtraImport": true, "detail": "client", "documentation": {} }, { "label": "MODBUS_SERVER_HOST", "importPath": "client", "description": "client", "isExtraImport": true, "detail": "client", "documentation": {} }, { "label": "MODBUS_SERVER_HOST", "kind": 5, "importPath": "client", "description": "client", "peekOfCode": "MODBUS_SERVER_HOST = \"192.168.70.55\" # IP-адрес Modbus-сервера\nMODBUS_SERVER_PORT = 502\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nclient = ModbusTcpClient(\n MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()", "detail": "client", "documentation": {} }, { "label": "MODBUS_SERVER_PORT", "kind": 5, "importPath": "client", "description": "client", "peekOfCode": "MODBUS_SERVER_PORT = 502\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\nclient = ModbusTcpClient(\n MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\ntry:", "detail": "client", "documentation": {} }, { "label": "client", "kind": 5, "importPath": "client", "description": "client", "peekOfCode": "client = ModbusTcpClient(\n MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\ntry:\n # читаем Y\n # 0 - зеленый свет\n # 1 - желтый свет\n addr = 2", "detail": "client", "documentation": {} }, { "label": "MODBUS_SERVER_HOST", "kind": 5, "importPath": "other_client", "description": "other_client", "peekOfCode": "MODBUS_SERVER_HOST = \"192.168.70.55\" # IP-адрес Modbus-сервера\nMODBUS_SERVER_PORT = 502\nclient = ModbusClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n unit_id=11,\n # debug=True\n)\nclient.open()\naddr = 2", "detail": "other_client", "documentation": {} }, { "label": "MODBUS_SERVER_PORT", "kind": 5, "importPath": "other_client", "description": "other_client", "peekOfCode": "MODBUS_SERVER_PORT = 502\nclient = ModbusClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n unit_id=11,\n # debug=True\n)\nclient.open()\naddr = 2\nlight = client.read_coils(addr, 1)", "detail": "other_client", "documentation": {} }, { "label": "client", "kind": 5, "importPath": "other_client", "description": "other_client", "peekOfCode": "client = ModbusClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n unit_id=11,\n # debug=True\n)\nclient.open()\naddr = 2\nlight = client.read_coils(addr, 1)\nprint(\"состояние лампочки\", light)", "detail": "other_client", "documentation": {} }, { "label": "addr", "kind": 5, "importPath": "other_client", "description": "other_client", "peekOfCode": "addr = 2\nlight = client.read_coils(addr, 1)\nprint(\"состояние лампочки\", light)\nprint(\"пишем противоположное\", not light[0])\nclient.write_single_coil(addr, not light[0])\nprint(\"теперь состояние\", client.read_coils(addr, 1))\nclient.close()", "detail": "other_client", "documentation": {} }, { "label": "light", "kind": 5, "importPath": "other_client", "description": "other_client", "peekOfCode": "light = client.read_coils(addr, 1)\nprint(\"состояние лампочки\", light)\nprint(\"пишем противоположное\", not light[0])\nclient.write_single_coil(addr, not light[0])\nprint(\"теперь состояние\", client.read_coils(addr, 1))\nclient.close()", "detail": "other_client", "documentation": {} }, { "label": "server", "kind": 5, "importPath": "server", "description": "server", "peekOfCode": "server = ModbusTcpServer(address=(MODBUS_SERVER_HOST, MODBUS_SERVER_PORT))", "detail": "server", "documentation": {} } ]