Giter Club home page Giter Club logo

Comments (3)

Planet911 avatar Planet911 commented on July 24, 2024

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.

pakerfeldt avatar pakerfeldt commented on July 24, 2024

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.

bashwork avatar bashwork commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.