{"id":23112087,"url":"https://github.com/zack-wang/modgate","last_synced_at":"2025-10-18T13:18:28.725Z","repository":{"id":50273321,"uuid":"518663002","full_name":"zack-wang/modgate","owner":"zack-wang","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-19T23:05:15.000Z","size":5502,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T23:44:34.768Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/zack-wang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-28T01:38:01.000Z","updated_at":"2022-07-28T02:07:56.000Z","dependencies_parsed_at":"2023-01-18T14:45:45.644Z","dependency_job_id":null,"html_url":"https://github.com/zack-wang/modgate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zack-wang/modgate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-wang%2Fmodgate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-wang%2Fmodgate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-wang%2Fmodgate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-wang%2Fmodgate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zack-wang","download_url":"https://codeload.github.com/zack-wang/modgate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zack-wang%2Fmodgate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266296760,"owners_count":23907012,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-17T02:16:50.869Z","updated_at":"2025-10-18T13:18:28.660Z","avatar_url":"https://github.com/zack-wang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modbus Gateway (modgate): read/write modbus device by url, 使用網址來讀寫modbus設備 \n## url format for reading,\n```\nhttp://0.0.0.0:8080/\u003cprotocol\u003e/\u003cip and port\u003e/\u003cfunction code\u003e/\u003caddress start\u003e/\u003clength\u003e/\u003cformat\u003e\n```\n\n1. protocol: only support modbustcp\n2. ip and port: modbus tcp device host and port, for example - 10.0.0.1:502\n3. function code: modbus function code, for example - 1, 2, 3, 4\n4. address start: start of modbus address\n5. length: number of readouts\n6. format: convert bytes to (integer) I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (float) F64BE,F64LE,F32BE,F32LE, (string) S64BE,S64LE\n\n## 讀取modbus的網址格式\n1. protocol: 目前只支持 modbustcp\n2. ip and port: modbus設備的地址與埠號, 例如 - 10.0.0.1:502\n3. function code: modbus的功能代碼, 例如 - 1, 2, 3, 4\n4. address start: modbus地址起始位置\n5. length: 讀出的資料個數\n6. format: 將位元組資料轉換成可以讀取的數值, (整數類)I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (浮點數) F64BE,F64LE,F32BE,F32LE, (字串) S64BE,S64LE\n\n## output format JSON\n```\n{\"code\":0,\"data\":[666,123],\"format\":\"I16BE\",\"message\":\"\"}\n```\n\n1. code: 0 succeed, others failed\n2. data: array of result\n3. format: same as input\n4. message: if code != 0, error message is here \n\n## 讀取到的資料(是JSON格式)說明\n1. code: 0成功, 非0失敗\n2. message: 失敗時的錯誤訊息\n3. format: 轉換的格式(與輸入相同)\n4. data: 資料陣列\n\n## url format for writing (http POST)\n```\nhttp://0.0.0.0:8080/\u003cprotocol\u003e/\u003cip and port\u003e/\u003cfunction code\u003e/\u003caddress start\u003e/\u003cformat\u003e\n\n[1,2,3,4]\n```\n1. protocol: only support modbustcp\n2. ip and port: modbus tcp device host and port, for example - 10.0.0.1:502\n3. function code: modbus function code, for example - 15 or 16\n4. address start: start of modbus address\n5. format: force convert data to these formats, (integer) I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (float) F64BE,F64LE,F32BE,F32LE, (string) S64BE,S64LE\n6. Refer to No.5. It may be panic, if you force convert data from string to number. I need some help to make this better. \n\n## 寫入modbus的網址格式, 使用http POST方式\n1. protocol: 目前只支持 modbustcp 協定\n2. ip and port: modbus設備的地址與埠號, 例如 - 10.0.0.1:502\n3. function code: modbus的功能代碼, 例如 - 15或16\n4. address start: modbus地址起始位置\n5. format: 將資料轉換成特定格式寫進去, 例如(整數類)I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (浮點數) F64BE,F64LE,F32BE,F32LE, (字串) S64BE,S64LE, 目前沒有檢查假如資料為字串, 強制轉成數字類可能會出錯\n\n## Static Page 靜態頁面\n### Show modegate data 用來呈現modgate資料\n```\nhttp://0.0.0.0:8080/ui/demo.html\n```\n1. Put your static in sub-folder ./html, 將你的靜態頁面放在 html 資料夾下面\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack-wang%2Fmodgate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzack-wang%2Fmodgate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzack-wang%2Fmodgate/lists"}