Function when UI form is loading?

Posted on
Tue Jun 26, 2018 2:10 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Function when UI form is loading?

I seem to remember reading on the forums a method/function that would fire when a form was loading before the user actually saw it that would allow the plugin to fill in some fields, am I on crack? I need to populate custom menu fields that just show up as blank because it's not a pre-defined static list (defaultValue doesn't work on my custom fields).

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
Tue Jun 26, 2018 2:23 pm
autolog offline
Posts: 2383
Joined: Sep 10, 2013
Location: West Sussex

Re: Function when UI form is loading?


Posted on
Tue Jun 26, 2018 2:28 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Re: Function when UI form is loading?

Yea, that's what I was trying to remember was that thread, but that's only for a menu item and not for a device.

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
Tue Jun 26, 2018 2:33 pm
DaveL17 offline
User avatar
Posts: 4194
Joined: Aug 20, 2013

Re: Function when UI form is loading?

Are you talking about getDeviceConfigUiValues()?


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jun 26, 2018 3:20 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Re: Function when UI form is loading?

DaveL17 wrote:
Are you talking about getDeviceConfigUiValues()?


Sent from my iPhone using Tapatalk

Maybe, I'm not sure. I can't find that one in the API docs.

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
Tue Jun 26, 2018 3:40 pm
DaveL17 offline
User avatar
Posts: 4194
Joined: Aug 20, 2013

Re: Function when UI form is loading?

I don't think it's in the docs.

Code: Select all
getDeviceConfigUiValues(self, valuesDict, typeId, devId)


Multitool Plugin Method Signature Tool:
Code: Select all
   Multitool                       self.getDeviceConfigUiValues: ArgSpec(args=['self', 'pluginProps', 'typeId', 'devId'], varargs=None, keywords=None, defaults=None)
   Multitool                       Docstring: None

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jun 26, 2018 3:41 pm
autolog offline
Posts: 2383
Joined: Sep 10, 2013
Location: West Sussex

Re: Function when UI form is loading?

Colorado4Wheeler wrote:
DaveL17 wrote:
Are you talking about getDeviceConfigUiValues()?


Sent from my iPhone using Tapatalk

Maybe, I'm not sure. I can't find that one in the API docs.

That's the one. You mentioned Menus which is why I gave you the link I did. :)

Take a look at the Plugin Developer Documenter Plugin - an excellent piece of documentation from @RogueProeliator. :)

Posted on
Tue Jun 26, 2018 4:25 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Re: Function when UI form is loading?

DaveL17 wrote:
I don't think it's in the docs.

Oh, well that is an excellent way to use the API, word of mouth... :roll: :roll: :shock: :shock: :lol: :lol:

Thanks for the unveiling of the super secret method!

autolog wrote:
That's the one. You mentioned Menus which is why I gave you the link I did.

I see that, I think my mind was focused on wanting to get a device config version of the menu function I had seen somewhere on the forums.

autolog wrote:
Take a look at the Plugin Developer Documenter Plugin - an excellent piece of documentation from @RogueProeliator.

That looks interesting, I'l. check it out.

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
Tue Jun 26, 2018 5:16 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Re: Function when UI form is loading?

Love this command. I've worked around not having this for years and a good number of my plugins had to do some pretty crazy stuff to get "pre-calculations" done, like hiding the entire form until they checked a box that then had a callback that then did the calculation that then enabled the fields.

In standard Indigo API fashion I see this is across all config UI's with a simple name change - also making my Actions much easier to default now too!

Thank you for the enlightenment!

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
Tue Jun 26, 2018 8:40 pm
DaveL17 offline
User avatar
Posts: 4194
Joined: Aug 20, 2013

Re: Function when UI form is loading?

For the future, here's an example:

Code: Select all
    def getDeviceConfigUiValues(self, valuesDict, typeId, devId):

        if typeId == 'someTypeId' and 'devicePropertyName' not in valuesDict.keys():
            valuesDict['devicePropertyName'] = "defaultValue"

        return valuesDict


I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jun 26, 2018 8:53 pm
Colorado4Wheeler offline
User avatar
Posts: 2715
Joined: Jul 20, 2009
Location: Colorado

Re: Function when UI form is loading?

Yup, I figured that out as it was the reason I needed the method.

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
Tue Jun 26, 2018 9:01 pm
DaveL17 offline
User avatar
Posts: 4194
Joined: Aug 20, 2013

Re: Function when UI form is loading?

That wasn't for you, my brother--that was for the next guy. :D

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest