Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.
/ modbus-restapi Public archive
forked from jubnzv/modbus-restapi

Expose Modbus TCP devices via REST API.

License

Notifications You must be signed in to change notification settings

grzesebe/modbus-restapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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]
}
  1. 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

About

Expose Modbus TCP devices via REST API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%