I see there are Phython modules, localdio and localain, for accessing the local digital and analog IO on an X4H but I do not see how I can make an instance of either. That is I assume I need to instantize the modules with something like this:
DIOlocal = localDIN(address)
But how do I get the address of the local IO ports?
In other words; for zigbee devices I can use ‘getnodelist()’ and get each device source arrdress. Is there an equivalent way to get the source address of the X4H IO?
You could likely check in the iDigi Dia src/devices/xbee/xbee_devices directory for the file xbee_local_aio_dio.py file and see how its done there.
I believe it imports the built-in digihw module, then uses that to instantiate:
Another resource that might show this is the Python Drivers for Digi Adapters library. Inside is a DigiXBeeDrivers.zip file, which contains localain.py and localdin.py:
So it seems the ‘digihw.py’ module is required to access the local IO (digital and analog) on the CP X4H. But I do not have a copy of this module. Could you point me to a link where I can get a copy?
No, the digihw is a builtin, there is no .PY file - the import hooks into the interface between Python and the underlying OS directly.
Also, the Wiki page for digihw is woofully incomplete. It does not talk about these functions. Why not? I don’t know.
Download the DigiXBeeDrivers mentioned above.
Technically, the local ain/dio is handled by the coordinator XBee, so for any address asked for you’d use the gateway’s coordinator MAC. This should be hidden from you if you use the provided examples.
I have been attempting to use the localain.py and localdio.py modules with only limited success. Here is what I have experienced so far:
The localain.py module has a ‘def calibration’ proc. From my testing it seems not to work, I get a key error, soI have just commented it out. Doing so has allowed the mod to work
in the localain.py mod ther eis a proc:
digihw.get_channel_type(channel) != Analog:
OOPS sorry my last post was incomplete! So, getting back to 2.
What are the expected channel types? I see from the mod that channel type Analog is 1. What is value of channel type digital? and are there others?
- It seems I could use ddo_get and ddo_set to accomplish the same thing the localain.py and localdio.py modules do. Am I missing something here?
Hello, I do not have an X4H to test this on, but you should be able to use the ddo_* methods just like you would on the XBee AIO/DIO (DIN) adapters.
Try copying the script below to your X4H and run from a telnet prompt to see what you get.
from sensor_io import parseIS
result = zigbee.ddo_get_param(None, ‘IS’)
except Exception, ex:
UPDATE: I had someone with an X4H try this script and it threw an exception. We will do some more testing and let you know what we may find.