modbus_test/.vscode/PythonImportHelper-v2-Compl...

164 lines
6.9 KiB
JSON

[
{
"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": "bulb",
"kind": 2,
"importPath": "client",
"description": "client",
"peekOfCode": "def bulb(addr):\n try:\n coils = client.read_coils(addr, 1, MODBUS_SLAVE_ID)\n print(\"читаем начальное состояние\", coils.bits)\n new_bits = coils.bits\n new_bits[0] = not new_bits[0]\n print(\"пытаемся записать\", new_bits, coils.slave_id)\n result = client.write_coil(addr, new_bits[0], coils.slave_id)\n print(result)\n print(\"читаем после попытки\", client.read_coils(0, len(coils.bits), coils.slave_id).bits)",
"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\nMODBUS_SLAVE_ID=11\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\ndef bulb(addr):\n try:\n coils = client.read_coils(addr, 1, MODBUS_SLAVE_ID)\n print(\"читаем начальное состояние\", coils.bits)",
"detail": "client",
"documentation": {}
},
{
"label": "MODBUS_SERVER_PORT",
"kind": 5,
"importPath": "client",
"description": "client",
"peekOfCode": "MODBUS_SERVER_PORT = 502\nMODBUS_SLAVE_ID=11\nfrom pymodbus.client import ModbusTcpClient\nfrom pymodbus.constants import Endian\nfrom pymodbus.payload import BinaryPayloadDecoder\ndef bulb(addr):\n try:\n coils = client.read_coils(addr, 1, MODBUS_SLAVE_ID)\n print(\"читаем начальное состояние\", coils.bits)\n new_bits = coils.bits",
"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 bulb(1)\nexcept Exception as e:\n print(\"error\", e)\nclient.close()",
"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": {}
}
]