I want to validate the action (device not already in the list, etc.) but placing the validation code and returning an errorDict within the button callback doesn't seem to work. So instead I call validateDeviceConfigUi from within the button callback and do something like:
- Code: Select all
a, b, c = self.validateDeviceConfigUi(valuesDict, typeId, devId)
if not a:
indigo.server.log(u"Error adding device.")
So if the validation returns false, then a is False and will throw the log message.
Is there a more straightforward way to do validation within a callback, or is this my best bet?