finding methods.

Posted on
Mon Jul 30, 2018 10:02 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

finding methods.

I recall that in ~ version 7 there was a new method introduced that is getting called envy few seconds (to refresh / give the option to update valuesDict parameters etc) in menus.

I looked at the API section but can not find it .. anyone recalls that one ..


Karl

Posted on
Mon Jul 30, 2018 10:35 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: finding methods.

I think you are referring to callback as outlined here/

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Jul 30, 2018 10:51 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: finding methods.

Added support for valuesDict['refreshCallbackMethod'] attribute which allows plugins to specify a UI refreshing callback method that is called approximately every second for updates. The callback method has the same signature as UI button actions and can return both a modified valuesDict and errorsDict for dynamic UI updating.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 30, 2018 12:30 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: finding methods.

yes , but it does not solve the problem.

Filter methods get an empty valuesDict at creation of devices/ events.
if I add a "CLICKme" button at the top and just call a dummy method that returns valuesDict, THEN filters get the populated valuesDict.

** eg
Code: Select all
            <Field     id="selectExistingDevice" type="menu" defaultValue="" visibleBindingId="newOrExistingDevice" visibleBindingValue="existing,delete">
                <Label>select devices in Event:</Label>
                <List class="self" filter="existing" method="filterDevicesEvent"  dynamicReload="true"/>
            </Field>
and then
Code: Select all
    def filterDevicesEvent(self, filter, valuesDict, typeId, targetId):
        xList =[]
        indigo.server.log("filterDevicesEvent:  typeId: "+ unicode(typeId)+"  targetId:"+ unicode(targetId)+"  valuesDict:"+unicode(valuesDict))
        if len(valuesDict) == 0:
            indigo.server.log("filterDevicesEvent:  vd empty returning")
            return xList
.....

if i add:
Code: Select all
             <Field    id="startCheck"       type="checkbox"  defaultValue="true"  hidden ="yes">  </Field>
            <Field    id="start" type="button"  visibleBindingId="startCheck" visibleBindingValue="true"  >
                <Label>To populate the fields hit start once</Label><Title> CLICKme </Title> <CallbackMethod> CLICKme </CallbackMethod>
            </Field>

Code: Select all
    def CLICKme(self, valuesDict, typeId, targetId):
        valuesDict["startCheck"] = False
        return valuesDict

populates everything .. but the user needs to press the button at least once... and then the button disappears...

BUT IT WOULD BE REALLY NICE IF FILTERS COULD GET A POPULATED VALUESDIC AT START !

Karl

Posted on
Mon Jul 30, 2018 12:40 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: finding methods.

If you have to have the user click a button to force the start of populating your valuesDict then I think you are wanting:

Code: Select all
 getMenuActionConfigUiValues(self, menuId)


That's for the menu actions, it's different for actions, devices, etc. This lets you prepop the form values before the user gets the UI. Just create and return the valuesDict.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Jul 30, 2018 4:04 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: finding methods.

kw123 wrote:
yes , but it does not solve the problem.

Filter methods get an empty valuesDict at creation of devices/ events.


Ah, but that wasn't the question you asked. I answered the question that you asked... ;)

I think it would be very useful if you could tell us what you're trying to do rather than just throw out code with little context. A full description of the problem is always the best place to start.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 30, 2018 4:26 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: finding methods.

I've always wanted to be able to update valuesDict from lists but pre-populating the UI before the user sees it has been a viable enough solution for me and then I just add a lot of conditions on the dynamic list fields so they don't error out when attempting to initially load (if I don't fix it via the get[insert_method_here]ConfigUiValues).

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Jul 30, 2018 7:52 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: finding methods.

This does the trick for me for EVENTS menu:
Code: Select all
    def getEventConfigUiValues(self,valuesDict, typeId, targetId):
        if targetId ==0:
            valuesDict["abc"] = initvalue
            self.someOther ="this is init"
        else:
            self.someOther ="this is after init"
        return super(Plugin, self).getEventConfigUiValues(valuesDict, typeId, targetId)

Karl

ps
Ah, but that wasn't the question you asked. I answered the question that you asked... ;)
I think it would be very useful if you could tell us what you're trying to do rather than just throw out code with little context. A full description of the problem is always the best place to start.

sorry for my poor communications skills .. not my bright point

Anyway, always wanted to try that method "valuesDict['refreshCallbackMethod'] "

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest