Comments (3)
Hi Patrik, I am new here but am having the same issue as you. I am interested in using pymodbus/example/contrib/serial-forwarder.py as a bridge from modbus-tcp to modbus-rtu(485). The example almost works for this purpose, except the unit-id is not passed from the tcp side to the rtu side. As you pointed out (https://groups.google.com/forum/#!topic/pymodbus/HkE_5gQ-gT8) RemoteSlaveContext in remote.py doesn't support unit_id's.
I'm not fluent in Python, but as far as I can tell the datastore model doesn't fit well with our scenarios. It allows one datastore for all requests or a datastore for each unit_id. I need a one datastore (i.e. the rtu-serial port) which is accessed for all unit_ids, with the unit_id being passed through to the serial port.
I'd like to help with this, but I think we both need some guidance from the more experienced people here. Is this the correct way to build a tcp-rtu bridge (or REST api - rtu bridge) with pymodbus?
from pymodbus.
I decided to base my project on NodeJS instead, using a completely different library. So to me, personally, this is no longer an issue. However, here's a patch on the remote.py changes I did to make it handle unit ids.
https://gist.github.com/pakerfeldt/9671aaf6e39e3c7912ac
from pymodbus.
So actually this is the slave context. The server context contains a collection of slave contexts, so the idea was that one could create the following basically::
server_context = {
0x00: client(host1),
0x01: client(host2),
}
For a single client with multiple slaves, the best plan would be to create a server context that supplies that with the message. So something to the effect of::
class RemoteServerContext(object):
def _getitem(self, slave):
return lambda req: self.client(req, slave)
from pymodbus.
Related Issues (20)
- TCP client frame mismatch under heavy load HOT 3
- Can add back kwarg 'reset_socket' to disable closing sockets on error HOT 4
- ModbusProtocol throws AttributeError : 'Serial' object has no attribute 'startswith' HOT 3
- incorrect register reading HOT 5
- Plans for 3.6.8 to be packaged in Debian / Ubuntu HOT 1
- ssl.SSLWantReadError: The operation did not complete (read) when using ModbusTlsClient HOT 19
- Server not returning data expected in data block HOT 7
- consider changing the github default landing branch to "master" ? HOT 3
- Intermittent Incomplete Modbus Messages When Polling a Slave Device HOT 34
- target machine actively refused connection HOT 13
- FramerType module not available with pymodbus 3.6.8. HOT 4
- TLS implementation seems broken? HOT 9
- Use pyserial RS485 - not serial_from_url HOT 3
- Serial Communication Drops After Few Messages on Ubuntu HOT 2
- How to get tag name with address HOT 2
- 2 ip address for 1 server HOT 2
- Register data missing HOT 1
- Bug when converting pymodbus.DATATYPE.FLOAT32 to float HOT 6
- pymodbus 3.6.8 does not work, while works with modbus-tk and pymodbus 2.5.3 HOT 5
- Example server_async.py: AttributeError: module 'helper' has no attribute 'get_commandline' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymodbus.