I’m running python scripts on a Digi ConnectPort X4 yet am unable to set a device’s panID using the xbee module’s ddo_set_param()
In the ConnectPort X4’s web control panel, I can see that the device is on my network in the XBee Network tab. Through the web interface, I can set it’s panID to, say, 0x1122334455667788. It then disappears from my XBee Network, as expected. I can then set the panID of my ConnectPort X4 to 0x1122334455667788 and shortly after the device reappears on my network, again, as expected.
However, I don’t seem to be able to this via a python script.
What does the xbee.ddo_set_param(addr, “ID”, input ) function expect as input ?
I’ve tried running the following command :
import xbee
xbee.ddo_set_param("[00:13:a2:00:40:70:75:e0]!", "ID", int("0x1122334455667788", 16))
But get the following error :
Traceback (most recent call last):
File "", line 1, in ?
TypeError: ddo_set_param: value must be an integer or string!
The problem being that int(“0x1122334455667788”, 16) returns a long. Of course, you can’t represent the panID as an integer as it has a range of 0 to 0xFFFFFFFFFFFFFFFF. So I’d logically need to specify it as a string.
However, I’ve tried the following and got the following errors :
>>> import xbee
>>> xbee.ddo_set_param("[00:13:a2:00:40:70:75:e0]!", "ID", str(int("0x1122334455667788", 16)))
Traceback (most recent call last):
File "", line 1, in ?
Exception: ddo_set_param: error setting DDO parameter.
>>> xbee.ddo_set_param("[00:13:a2:00:40:70:75:e0]!", "ID", "0x1122334455667788")
Traceback (most recent call last):
File "", line 1, in ?
Exception: ddo_set_param: error setting DDO parameter.
>>> xbee.ddo_set_param("[00:13:a2:00:40:70:75:e0]!", "ID", "1122334455667788")
Traceback (most recent call last):
File "", line 1, in ?
Exception: ddo_set_param: error setting DDO parameter.
What does the xbee.ddo_set_param(addr, “ID”, input ) function expect as input ?
Also, just as proof that my error isn’t in the connection between the CP X4 and the device, I can set the node identifier using the following :
>>> import xbee
>>> xbee.ddo_set_param("[00:13:a2:00:40:70:75:e0]!", "NI", "BBB-106")
True
And the new name “BBB-106” shows up in the CP X4’s web based admin panel.