A port absolutely makes sense. Not only would it remove a dependency, but it would be a good chance to get a fresh implementation to address a few bugs. Most all of the protocol code can be used, just the transport code needs to be rewritten.
--
You received this message because you are subscribed to the Google Groups "pymodbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymodbus+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Awesome, well have fun. I'll try to get around to a port when I get time if you don't beat me to it. Everything should work fine except RTU which you can work around. Basically just read as fast as possible and it should work well enough.
Galen
I just looked a bit at what and how pymodbus uses Twisted. It really seems to be well separated into the async packages, reusing common logic for the real protocol. Nice work. Also it looks like only basic features of Twisted were used that are indeed part of asyncio, in contrast to the long list of advanced googies where Twisted seems to distinguish itself.I need to learn a bit about both libs first, at some point I'll probably start playing around, If I get anywhere useful for the public or find out about the one big bugger why this will never-ever work, I'll post it.
--
import asynciofrom pymodbus.client.async2 import ModbusClientProtocol
loop = asyncio.get_event_loop()
@asyncio.coroutinedef process_tcp(): transport_, protocol_ = yield from loop.create_connection(ModbusClientProtocol, "192.168.178.240", 502) result = yield from protocol_.read_coils(1) print("Result: %d" % result.bits[0]) transport_.close()
loop.run_until_complete(process_tcp())loop.close()Awesome; this is a great Xmas present. Any chance you have your work hosted so I can take a look? I would be very interested in making the 3.x branch focused on asycnio instead of twisted.
Galen
@asyncio.coroutinedef process_tcp2(): client = ReconnectingAsyncioModbusTcpClient() yield from client.start("192.168.178.240")result = yield from client.protocol.read_coils(1)Hey Mads,I don't think the asnycio stuff for Python 3 is still considered to be merged in the main project. However, feel free to send UDP asyncio extensions to my fork. I'd include it.