{"id":23480465,"url":"https://github.com/qtoggle/qtoggleserver-modbus","last_synced_at":"2025-07-08T12:07:55.877Z","repository":{"id":47438074,"uuid":"514683889","full_name":"qtoggle/qtoggleserver-modbus","owner":"qtoggle","description":"Modbus client/server for qToggleServer","archived":false,"fork":false,"pushed_at":"2025-06-13T06:44:08.000Z","size":43,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T07:37:18.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qtoggle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-16T21:00:42.000Z","updated_at":"2025-05-17T20:25:04.000Z","dependencies_parsed_at":"2024-02-03T16:24:29.772Z","dependency_job_id":"bcebb965-e00b-4e4f-bae4-3c2646f6fc4d","html_url":"https://github.com/qtoggle/qtoggleserver-modbus","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/qtoggle/qtoggleserver-modbus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtoggle%2Fqtoggleserver-modbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtoggle%2Fqtoggleserver-modbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtoggle%2Fqtoggleserver-modbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtoggle%2Fqtoggleserver-modbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qtoggle","download_url":"https://codeload.github.com/qtoggle/qtoggleserver-modbus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtoggle%2Fqtoggleserver-modbus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264267069,"owners_count":23581929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-24T20:13:28.946Z","updated_at":"2025-07-08T12:07:55.851Z","avatar_url":"https://github.com/qtoggle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\n\nThis is an addon for [qToggleServer](https://github.com/qtoggle/qtoggleserver).\n\nWith this addon you can read and control Modbus-enabled devices (such as energy meters) via qToggleServer. You can also\nconfigure a Modbus server so that your qToggleServer behaves like a Modbus device itself.\n\n\n## Install\n\nInstall using pip:\n\n    pip install qtoggleserver-modbus\n\n\n## Usage\n\n### Serial Client\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.ModbusSerialClient\"\n        method = rtu                    # `ascii` (default), `rtu` or `binary`\n        serial_port = \"/dev/ttyUSB0\"\n        serial_baud = 9600              # this is the default\n        serial_stopbits = 1             # this is the default\n        serial_bytesize = 8             # this is the default\n        serial_parity = N               # `N`, `E` or `O`\n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### Serial Server\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.ModbusSerialServer\"\n        method = rtu                    # `ascii` (default), `rtu` or `binary`\n        serial_port = \"/dev/ttyUSB0\"\n        serial_baud = 9600              # this is the default\n        serial_stopbits = 1             # this is the default\n        serial_bytesize = 8             # this is the default\n        serial_parity = N               # `N`, `E` or `O`\n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### TCP Client\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.ModbusTcpClient\"\n        method = socket                 # `socket` (default), `ascii`, `rtu` or `binary`\n        tcp_host = \"192.168.0.2\"        # IP or hostname of the Modbus device\n        tcp_port = 502                  # Modbus device TCP port\n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### TCP Server\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.ModbusTcpServer\"\n        method = socket                 # `socket` (default), `ascii`, `rtu` or `binary`\n        tcp_address = \"0.0.0.0\"         # binds on all interfaces by default\n        tcp_port = 502                  # Modbus device TCP port\n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### Passive Serial Client\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.PassiveModbusSerialClient\"\n        serial_port = \"/dev/ttyUSB0\"\n        serial_baud = 9600              # this is the default\n        serial_stopbits = 1             # this is the default\n        serial_bytesize = 8             # this is the default\n        serial_parity = N               # `N`, `E` or `O`\n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### Passive TCP(dump) Client\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        driver = \"qtoggleserver.modbus.PassiveModbusTcpClient\"\n        port = 5020                     # TCP port to sniff\n        iface = \"eth0\"                  # network interface to sniff (defaults to `any`)\n        master_ip = \"192.168.1.122\"     # IP address of the master Modbus machine (optional) \n        slave_ip = \"192.168.1.123\"      # IP address of the slave Modbus machine (optional)\n        master_port = 5020              # TCP port of the master Modbus machine (optional) \n        slave_port = 5021               # TCP port of the slave Modbus machine (optional)\n        tcpdump = \"/usr/bin/tcpdump\"    # full path to the `tcpdump` binary (optional) \n        # see below for common parameters\n    }\n    ...\n]\n...\n```\n\n### Common Parameters\n\nThe following parameters are common to all types of Modbus clients and servers:\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        ...\n        name = \"mydevice\"  # an optional name of your choice\n        timeout = 5        # in seconds, this is the default\n        unit_id = 0           # slave unit id, this is the default\n        ports = {\n            \"port_id1\" = {\n                modbus_type = coil          # `coil`, discrete_input`, `input_register` or `holding_register`\n                address = 1234              # Modbus port address (from `0000` to `9999`)\n                # number of successive registers mapped to the port, starting at `address` (defaults to `1`)\n                length = 2\n                writable = false            # by default is `null`, inferred from `modbus_type`\n                # `struct` format to use to group multiple register values into a byte array (defaults to `\u003e` followed\n                # by `H` times `length`)\n                register_group_fmt = \"\u003eHH\"\n                # `struct` format to use to map register byte array to port value (defaults to `\u003eh`)\n                value_fmt = \"\u003ei\"\n            }\n            ...\n        }\n        ...\n    }\n    ...\n]\n...\n```\n\n### Common Client Parameters\n\nThe following parameters are common to all types of Modbus clients:\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        ...\n        use_single_functions = false  # set to `true` to use single Modbus access functions instead of multi ones\n        initial_delay = 5             # the number of seconds to delay polling after connection (defaults to `0`)\n        ...\n    }\n    ...\n]\n...\n```\n\n### Common Server Parameters\n\nThe following parameters are common to all types of Modbus servers:\n\n##### `qtoggleserver.conf:`\n``` ini\n...\nperipherals = [\n    ...\n    {\n        ...\n        identity_vendor_name = \"My Vendor\"\n        identity_product_code = \"PROD1234\"\n        identity_major_minor_revision = \"3.14.15\"\n        identity_vendor_url = \"https://example.com\"\n        identity_product_name = \"My Product\"\n        identity_model_name = \"My Model\"\n        identity_user_application_name = \"My Custom Model\"\n        ...\n    }\n    ...\n]\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtoggle%2Fqtoggleserver-modbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqtoggle%2Fqtoggleserver-modbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtoggle%2Fqtoggleserver-modbus/lists"}