API Change: getDeviceStateList / getDeviceDisplayStateId
Posted: Wed Oct 19, 2011 5:52 pm
In the release version of v5.0.0 we have a couple of plugin API changes. If your plugin defines either method getDeviceStateList or getDeviceDisplayStateId, then note that the argument list will be changing and your plugin will need to be modified.
The old method signatures were:
The new method signature removes the typeId and devId arguments and instead passes a full indigo.Device instance object. This is useful for plugins that want full access to the device's properties to dynamically calculate the state list (or display state ID). For compatibility with the new version you can change your method definition and add the following 2 lines to set the previous argument values.
Note that we do our best to not make these types of incompatible API changes, but since Indigo is still in beta and I believe there are only a couple of plugins that might be effected we opted not to try to maintain the old method signature in this case.
The old method signatures were:
- Code: Select all
def getDeviceStateList(self, typeId, devId):
...
def getDeviceDisplayStateId(self, typeId, devId):
...
The new method signature removes the typeId and devId arguments and instead passes a full indigo.Device instance object. This is useful for plugins that want full access to the device's properties to dynamically calculate the state list (or display state ID). For compatibility with the new version you can change your method definition and add the following 2 lines to set the previous argument values.
- Code: Select all
def getDeviceStateList(self, dev):
typeId = dev.deviceTypeId
devId = dev.id
...
def getDeviceDisplayStateId(self, dev):
typeId = dev.deviceTypeId
devId = dev.id
...
Note that we do our best to not make these types of incompatible API changes, but since Indigo is still in beta and I believe there are only a couple of plugins that might be effected we opted not to try to maintain the old method signature in this case.