https://github.com/jubnzv/modbus-restapi
Expose Modbus TCP devices via REST API.
https://github.com/jubnzv/modbus-restapi
flask-restful modbus-tcp rest-api
Last synced: 12 months ago
JSON representation
Expose Modbus TCP devices via REST API.
- Host: GitHub
- URL: https://github.com/jubnzv/modbus-restapi
- Owner: jubnzv
- License: mit
- Created: 2018-03-31T16:14:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-08T12:36:54.000Z (about 8 years ago)
- Last Synced: 2025-04-06T11:05:51.770Z (about 1 year ago)
- Topics: flask-restful, modbus-tcp, rest-api
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# modbus-restapi
Small Flask application that exposes Modbus TCP devices with REST API. Using to perform some testing routines.
### Available functions
1. Read Modbus registers: `POST` on (`/modbus-explorer/api/tcp/read'`):
````
{
ip: [string],
port: [integer],
slave_id: [integer],
type_prefix: [integer],
start_address: [integer],
count: [integer]
}
````
2. Write Modbus registers: `POST` on (`/modbus-explorer/api/tcp/post'`):
````
{
ip: [string],
port: [integer],
slave_id: [integer],
type_prefix: [integer],
start_address: [integer],
data: [array of integers]
}
````
### Usage examples
Read first 10 coils:
```
curl -i -H "Content-Type: application/json" -X POST -d '{"ip":"localhost", "port":"5020", "slave_id": 1, "type_prefix": 1, "start_address": 1, "count": 10}' http://localhost:5000/modbus-explorer/api/tcp/read
```
Write some coils:
```
curl -i -H "Content-Type: application/json" -X POST -d '{"ip":"localhost", "port":"5020", "slave_id": 0, "type_prefix": 1, "start_address": 10, "data": [1, 0, 0, 1]}' http://localhost:5000/modbus-explorer/api/tcp/write
```