I have defined a MenuItems.XML that looks like this:
- Code: Select all
<?xml version="1.0"?>
<MenuItems>
<MenuItem id="menu1">
<Name>Update last notification time...</Name>
<CallbackMethod>updateLastNotificationTimeManually</CallbackMethod>
<ButtonTitle>Update</ButtonTitle>
<ConfigUI>
<Field id="targetDevice" type="menu">
<Label>Device:</Label>
<List class="indigo.devices" filter="com.perceptiveautomation.indigoplugin.notification"/>
</Field>
<Field id="newValue" type="textfield">
<Label>New time value (Y-m-d H:m:s):</Label>
</Field>
</ConfigUI>
</MenuItem>
</MenuItems>
The callback method looks like this:
- Code: Select all
def updateLastNotificationTimeManually ( self, valuesDict, typeId ):
if self.extDebug: self.debugLog(u"updateLastNotificationTimeManually action called: props: %s" % (str(valuesDict)))
try:
dev = indigo.devices[int(valuesDict[u'targetDevice'])]
dev.updateStateOnServer(u'lastNotificationTime',valuesDict[u'newValue'])
indigo.server.log(u'Last notification time for device "%s" set to %s' % (dev.name, valuesDict[u'newValue']))
return True
except:
self.ErrorLog(u'Could not update last notification time manually')
return
Now, if I run this menu item three times the Indigo client (not the server) will crash on the third time. There are no errors in the Indigo log. The indigo client has also crashed randomly without calling this method, but only after I added the method. Is there something wrong with the above code, or should I look somewhere else for the error?