Greetings,
If I make change to a plugin's device.xml file the only way I have found to get the device to see the change is to delete the device and then add it as new. Is there a simpler way to do this?
kind regards,
Z
dev.stateListOrDisplayStateIdChanged()
<Field id = "SupportsStatusRequest" type = "checkbox" hidden = "true" defaultValue = "true">
<Label>Enable status request / refresh button:</Label>
</Field>
props = dev.pluginProps
props["SupportsStatusRequest"] = True
dev.replacePluginPropsOnServer(props)
def deviceStartComm(self, dev):
props = dev.pluginProps
props["SupportsStatusRequest"] = True
dev.replacePluginPropsOnServer(props)
props updated for device new device 2
<<-- entering deviceStartComm: new device 2 (9258035 - pluginDevice)
added device "systematicRB""
exiting deviceStartComm1 -->>
<<-- entering deviceStopComm: new device 2 (9258035 - pluginDevice)
removed device "systematicRB"
exiting deviceStopComm -->>
props = dev.pluginProps
if not "SupportsStatusRequest" in props: # Check if property exists and if it doesn't just add it to the props, save it on the server and return as the device will be restarted
props["SupportsStatusRequest"] = True
dev.replacePluginPropsOnServer(props)
return
elif props["SupportsStatusRequest"] != True: # Check if property's required initial value and if not update the property, save it on the server and return as the device will be restarted
props["SupportsStatusRequest"] = True
dev.replacePluginPropsOnServer(props)
return
# At this point the property exists and is set to the correct value - you can now continue starting the device
def startup(self):
self.debugLog(u"startup called")
for dev in indigo.devices.itervalues("self"):
props = dev.pluginProps
props["SupportsStatusRequest"] = True
dev.replacePluginPropsOnServer(props)
self.errorLog("props updated for device %s" %dev.name)
Systematic Debug startup called
Systematic Debug props updated for device 1
Systematic Debug props updated for device 2
Systematic Debug props updated for device 3
Systematic Debug props updated for device 4
Systematic Debug props updated for device 5
Systematic Debug props updated for device 6
Systematic Debug props updated for device 7
Systematic Debug props updated for device SystematicRB
The dev.stateListOrDisplayStateIdChanged() method only updates the states list, not the properties of the device. It is used because states are static and cannot be modified outside the XML (thus if you do modify the XML Indigo needs to be told they changed).
Users browsing this forum: No registered users and 3 guests