advancedclimatesystems / tolk Goto Github PK
View Code? Open in Web Editor NEWTolk exposes a JSON-RPC API to talk Modbus over RTU or TCP
License: Mozilla Public License 2.0
Tolk exposes a JSON-RPC API to talk Modbus over RTU or TCP
License: Mozilla Public License 2.0
Although there's the possibility to specify an alternative location of the Tolk socket with the option --socket
, json_rpc_client always opens a socket on /tmp/tolk.sock
.
It would be nice to also run test in python 2.6 on travis
Currently when a Modbus server returns an Modbus error code, Tolk returns a JSON-RPC error with code -32603: Internal JSON-RPC error containing the stacktrace. Response below fails with Modbus exception code 2: Illegal Data Address.
{
"error": {
"code": -32603,
"data": "Traceback (most recent call last):\n File \"/home/auke/projects/tolk/.env/local/lib/python2.7/site-packages/pyjsonrpc/rpclib.py\", line 115, in call\n result = rpc_function(*positional_params, **named_params)\n File \"/home/auke/projects/tolk/scripts/../tolk/json_rpc.py\", line 25, in read_coils\n int(quantity))\n File \"/home/auke/projects/tolk/.env/local/lib/python2.7/site-packages/modbus_tk/utils.py\", line 26, in new\n raise excpt\nModbusError: Modbus Error: Exception code = 2\n",
"message": "Internal JSON-RPC error."
},
"id": 246344073102444981514353044232564665595,
"jsonrpc": "2.0"
}
The JSON-RPC specification leaves room for custom errors.
Below the surface Tolk uses Modbus-TK which implements 7 Modbus error codes. Tolk should return custom JSON-RPC errors reflecting the Modbus error code that was returned. Tolk should implement the following error codes:
An error response now could look like this:
{
"error": {
"code": -32001,
"data": "Function code 27 is not valid."
},
"id": 246344073102444981514353044232564665595,
"jsonrpc": "2.0"
}
We need to support python 3. This is going to need a complete rewrite of the modbus protocol implementation, as modbus_tk
is not python3 compatible, and is generally not very nice to work with (bad exception handling, etc).
This issue serves as a central place for discussing python 3 support and implementation progress.
This scripts uses invalid method name 'discrete_inputs'. Instead it should use 'read_discrete_inputs'.
When you want to write multiple coils or multiple registers Dispatcher.write_multiple_coils
received a list with values for parameter values
like this [0, 1, 0, 1, 0, 0]
. The Dispatcher ignores the trailing 0
en only write 4 coils instead of 6. Dispatcher.write_multiple_registers
had same problem.
Tolk should switch from modbus_tk
to umodbus
when it's stable and feature complete enough.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.