Page 1 of 1

Modbus PlugIn

PostPosted: Thu Dec 19, 2013 4:22 pm
by jblackburn
Hi,

I have some devices using Modbus protocol on TCP/IP. I've started to develop a plug-in to connect my device to Indigo. I'm using pymodbus (TCP/IP) library and everything work fine in the Mac OS X terminal environnement. I've transposed my code inside the plugin of Indigo but I'm not able to connect to my ip device with the same code!?!?! I'm a little bit confuse!!! I'm lost between both interface... I have put a copy of the library directly in the 'contents' folder of the plugin structure as required. Do I need to install the pymodbus library inside Indigo Python environnement as I've done in the Mac OS X terminal?

http://code.google.com/p/pymodbus/

If it is the case, plugin distribution will not be easy:

PS: It's my first post, be nice with me! :D

Thanks!

Joël

Re: Modbus PlugIn

PostPosted: Thu Dec 19, 2013 6:32 pm
by berkinet
It is usually best to include any needed code in the plugin. It should normally be in, or under, the resources directory.

Re: Modbus PlugIn

PostPosted: Fri Dec 20, 2013 4:56 pm
by jblackburn
I've tried with a different library (modbus-tk) and I have the same issue. It's working in the Mac OS X shell but not in the indigo python shell!?!

Thanks!

Joël

Re: Modbus PlugIn

PostPosted: Fri Dec 20, 2013 5:02 pm
by berkinet
Do you "import" the modbus libs?

If so, just placing them in the same directory as plugin.py should work. However, if the modbus module calls other modules, you may need to place them in an appropriate hierarchy.

You might take a look at the Phidgets plugin to see how I included the Phidgets libs. You will see that plugin.py imports modules for the difference device types the plugin can create. Then, each of those modules imports Phidgets standard modules that are contained in a sub-directory.

Re: Modbus PlugIn

PostPosted: Sat Dec 21, 2013 1:02 pm
by jblackburn
Thanks for your input! I think I solved my problem. It's was the 'import' way and other minor things (e.g. test object, ...)... :wink:

PS: Your plugins are amazing!

Joël