- Code: Select all
<ConfigUI refreshCallbackMethod='refreshDeviceConfigUi'>
...
</ConfigUI>
- Code: Select all
<ConfigUI>
<refreshCallbackMethod>refreshDeviceConfigUi</refreshCallbackMethod>
...
</ConfigUI>
<ConfigUI refreshCallbackMethod='refreshDeviceConfigUi'>
...
</ConfigUI>
<ConfigUI>
<refreshCallbackMethod>refreshDeviceConfigUi</refreshCallbackMethod>
...
</ConfigUI>
def getDeviceConfigUiValues(self, pluginProps, typeId, devId):
valuesDict = pluginProps
errorMsgDict = indigo.Dict()
valuesDict['refreshCallbackMethod'] = 'nameOfYourRfreshMethod'
return (valuesDict, errorMsgDict)
def getDeviceFactoryUiValues(self, devIdList):
valuesDict = indigo.Dict()
valuesDict['refreshCallbackMethod'] = 'nameOfYourRfreshMethod'
errorMsgDict = indigo.Dict()
return (valuesDict, errorMsgDict)
matt (support) wrote:It wasn't very clear on that other forum thread so here is an example. Although it might be possible to do via XML, it is easier to just handle by overriding one of these methods (use the first one unless you are using the device factory UI option): And note you can conditionalize it based on the passed in device typeId if you need.
<ConfigUI>
<Field id="refreshCallbackMethod" type="textfield" hidden="true" defaultValue="refreshDeviceConfigUi"/>
....
</ConfigUI>
def getPrefsConfigUiValues(self):
valuesDict, errDict = super(Plugin, self).getPrefsConfigUiValues()
valuesDict[u"refreshCallbackMethod"] = "setabc"
return valuesDict
def setabc(self,valuesDict=None):
def setabc(self, valuesDict=None):
valuesDict = indigo.Dict()
valuesDict ["myParamter"] = "abc"
return valuesDict
def getPrefsConfigUiValues(self):
(valuesDict, errorsDict) = super(Plugin, self).getPrefsConfigUiValues()
valuesDict[u"refreshCallbackMethod"] = "setabc"
return (valuesDict, errorsDict)
def getPrefsConfigUiValues(self):
(valuesDict, errorsDict) = super(Plugin, self).getPrefsConfigUiValues()
valuesDict[u"refreshCallbackMethod"] = "prefsRefreshCallback"
return (valuesDict, errorsDict)
def prefsRefreshCallback(self, valuesDict):
indigo.server.log(u"prefsRefreshCallback called")
indigo.server.log(u"valuesDict: {}".format(valuesDict))
return valuesDict
def filterWiFiDevice(self, filter="", valuesDict=None):
def theCallbackmethod(self,valuesDict=None):
def theCallbackmethod(self, filter="", valuesDict=None):
kw123 wrote:.. and I thought that using valuesDict=xxx would always work no matter where in the sequence is it in def xx(....):
#! /usr/bin/env python
# -*- coding: utf-8 -*-
def foo(a=1, b=None):
print(u"{} {}".format(a, b))
foo(b=2, a=3)
>>>3 2
kw123 wrote:... and I thought that using valuesDict=xxx would always work no matter where in the sequence is it in def xx(....): So I guess valuesDict is not an optional parameter and the first one listed in def() will get the data
RogueProeliator wrote:And should be kicked back in code review by any competent engineering manager...
It must be so boring to have such a linear view of the universe.
kw123 wrote:.. and I thought that using valuesDict=xxx would always work no matter where in the sequence is it in def xx(....):
So I guess valuesDict is not an optional parameter and the first one listed in def() will get the data
def foo(bar={}):
def foo(bar=[]):
print(bar)
bar.append('x')
foo()
foo() # you might think you're getting an empty list here, but you're not.
>>> []
>>> ['x']
Users browsing this forum: No registered users and 9 guests