{"id":17477770,"url":"https://github.com/cloud-automation/chrome-modbus","last_synced_at":"2025-04-22T10:36:58.422Z","repository":{"id":20056423,"uuid":"23324977","full_name":"Cloud-Automation/chrome-modbus","owner":"Cloud-Automation","description":"Modbus/TCP for Chrome Apps.","archived":false,"fork":false,"pushed_at":"2016-09-16T18:12:13.000Z","size":214,"stargazers_count":34,"open_issues_count":3,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-22T10:36:24.981Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cloud-Automation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-25T19:00:47.000Z","updated_at":"2024-12-06T09:56:50.000Z","dependencies_parsed_at":"2022-09-02T13:41:01.780Z","dependency_job_id":null,"html_url":"https://github.com/Cloud-Automation/chrome-modbus","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cloud-Automation%2Fchrome-modbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cloud-Automation%2Fchrome-modbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cloud-Automation%2Fchrome-modbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cloud-Automation%2Fchrome-modbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cloud-Automation","download_url":"https://codeload.github.com/Cloud-Automation/chrome-modbus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250221795,"owners_count":21394766,"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-10-18T20:09:36.083Z","updated_at":"2025-04-22T10:36:58.291Z","avatar_url":"https://github.com/Cloud-Automation.png","language":"JavaScript","readme":"# Chrome Modbus\n\nClient and Server implementation for the Modbus TCP/IP Protocol. The client supports the function codes 1,3,4,5,6.\n\n## Installation\n\nThe Project depends on jQuery so make sure to include jQuery into your App. (Note: Chrome Modbus currently uses the promise API from jQuery, it is planed to switch to Q, so this is subject to change.)\n\nInsert the modbus.min.js into your project.\n\n    \u003cscript src=\"modbus.min.js\"\u003e\u003c/script\u003e\n\n## Client Setup\n\nCreate a client object.\n\n    var client = new ModbusClient();\n\nSetup different handler.\n\nIf a connect attempt succeeded the 'online' event is fired,\n\n    client.on('online', function () {\n\n       console.log('connected');\n\n    });\n\nIf the client gets disconnected the 'offline' event is fired.\n\n    client.on('offline', function () {\n\n        console.log('disconnected');\n\n    });\n\nIf there is a connection error the error event is fired. You can use this event to reconnect for example.\n\n    client.on('error', function () {\n\n        setTimeout(function () {\n\n            client.reconnect();\n\n        }, 5000);\n\n    });\n\nConnect to a Modbus Server.\n\n    client.connect(host, port);\n\n### Execute function calls.\n\nThe supported function calls return a promise. So add a callback to then with the data and the original request object to handle a successfull operation.\n\n#### FC 01 - Read Coils\n\n    client.readCoils(start, count).then(function (data, request) {\n\n        ...\n\n    }).fail(function (err) {\n\n        ...\n\n    });\n\n#### FC 03 - Read Holding Registers\n\n    client.readHoldingRegisters(start, count);\n\n#### FC 04 - Read Input Registers\n\n    client.readInputRegisters(start, count);\n\n#### FC 05 - Write Single Coil\n\n    client.writeSingleCoil(address, value).then(function (request) { ... })\n        .fail(function (err) { ... });\n\n#### FC 06 - Write Single Register\n\n    client.writeSingleRegister(address, value).then(function (request) { ... })\n        .fail(function (err) { ... });\n\n## Loop\n\nModbus Loops are a tool to poll certain modbus requests in a loop. Create a loop and call the modbus functions to register them. Start the loop to get updates.\n\nCreate a new loop instance.\n\n    var loop = new ModbusLoop(client);\n\nRegister a new function call for this loop;\n\n    loop.readInputRegisters(0, 10);\n\n    loop.readHoldingRegisters(0, 10);\n\nHandle loop updates.\n\n    loop.on('update', function (inputRegisters, holdingRegisters) {\n\n        // input registers 0 .. 9 are in inputRegisters[0] .. inputRegisters[9]\n        // holding registers 0 .. 9 are in holdingRegisters[0] .. holdingRegisters[9]\n\n    });\n\nStart the loop.\n\n    loop.start();\n\nStop the loop.\n\n    loop.stop();\n\nHandle errors.\n\n    loop.on('error', function (err) {\n\n        // loop is automatically stopped\n\n        loop.start();\n\n    });\n\nNote: You can add new modbus requests at any time.\n\n Licence\n\nThe MIT License (MIT)\nCopyright © 2014 Stefan Pöter, stefan.poeter[at]cloud-automation.de\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-automation%2Fchrome-modbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud-automation%2Fchrome-modbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-automation%2Fchrome-modbus/lists"}