I use 5 EasyDAQ relay/DIO boards. I would like to add some code to validateDeviceConfigUi in plugin.py so that if I try to add a channel (mirror device) for a board and that channel is already used I would get a warning and be prevented from adding it as a mirrored device.
I have com up with the following:
- Code: Select all
inUseList = []
isRelay = ('relay %d' %valuesDict["channelSel"])
inUseList = [dev.name for dev in indigo.devices]
if isRelay in inUseList:
errorsDict["channelSel"] = u"relay is already configured"
This works gut with one board but not with multiple boards because other boards have the same channel number. Thus it may see a duplicate channel and give the error but the channel is really from another board (because my code gets all the devices). What I need to get is the list of devices for the inUseList but only for the current device selected but I cannot find a way to do this?
Is it possible for you to give me some direction?
Thanks to you,
Z