Colorpicker API

Posted on
Thu Jan 25, 2018 9:20 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Colorpicker API

I guess I'm just full of questions today. What's the expected format for the defaultValue of the colorpicker API?

Code: Select all
   ...
      <ConfigUI>
         <Field id="rgbColor" type="colorpicker" defaultValue="=">
            <Label>Color:</Label>
            <CallbackMethod>rgbColorPickerUpdated</CallbackMethod>
         </Field>
      </ConfigUI>
      ...

I can force it by setting the raw value (FF FF 00) using valuesDict in getDeviceConfigUiValues() , but I can't seem to find a format to set it using 'defaultValue' within Devices.xml.

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

[My Plugins] - [My Forums]

Posted on
Tue Jan 30, 2018 6:55 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Colorpicker API

I've tried many combinations without success. Is the defaultValue attribute not yet implemented for the colorpicker field type?

Code: Select all
<!-- Color Test Device -->
    <Device type="custom" id="colorTest">
        <Name>Color</Name>

        <ConfigUI>

            <Field id="color1" type="colorpicker" defaultValue="#FFFFFF">
                <Label>Color 1</Label>
            </Field>

            <Field id="color2" type="colorpicker" defaultValue="=#FFFFFF">
                <Label>Color 2</Label>
            </Field>

            <Field id="color3" type="colorpicker" defaultValue="#FFFFFFFF">
                <Label>Color 3</Label>
            </Field>

            <Field id="color4" type="colorpicker" defaultValue="=#FFFFFFFF">
                <Label>Color 4</Label>
            </Field>

            <Field id="color5" type="colorpicker" defaultValue="FF FF FF">
                <Label>Color 5</Label>
            </Field>

            <Field id="color6" type="colorpicker" defaultValue="=FF FF FF">
                <Label>Color 6</Label>
            </Field>

            <Field id="color7" type="colorpicker" defaultValue="=FF FF FF FF">
                <Label>Color 7</Label>
            </Field>

            <Field id="color8" type="colorpicker" defaultValue="FF FF FF FF">
                <Label>Color 8</Label>
            </Field>

            <Field id="color9" type="colorpicker" defaultValue="(255,255,255)">
                <Label>Color 9</Label>
            </Field>

            <Field id="color10" type="colorpicker" defaultValue="=(255,255,255)">
                <Label>Color 10</Label>
            </Field>

            <Field id="color11" type="colorpicker" defaultValue="(255,255,255,0.5)">
                <Label>Color 11</Label>
            </Field>

            <Field id="color12" type="colorpicker" defaultValue="=(255,255,255,0.5)">
                <Label>Color 12</Label>
            </Field>

            <Field id="color13" type="colorpicker" defaultValue="white">
                <Label>Color 13</Label>
            </Field>

            <Field id="color14" type="colorpicker" defaultValue="=white">
                <Label>Color 14</Label>
            </Field>

            <Field id="color15" type="colorpicker" defaultValue="='white'">
                <Label>Color 15</Label>
            </Field>

        </ConfigUI>

        <States>
            <State id="onOffState">
                <ValueType>Boolean</ValueType>
                <TriggerLabel>Device State</TriggerLabel>
                <ControlPageLabel>Device State</ControlPageLabel>
            </State>
        </States>
        <UiDisplayStateId>onOffState</UiDisplayStateId>

    </Device>

Nothing seems to get through:
Code: Select all
globalProps : MetaProps : (dict)
     com.fogbert.indigoplugin.plugin_name : (dict)
          color1 :  (string)
          color10 :  (string)
          color11 :  (string)
          color12 :  (string)
          color13 :  (string)
          color14 :  (string)
          color15 :  (string)
          color2 :  (string)
          color3 :  (string)
          color4 :  (string)
          color5 :  (string)
          color6 :  (string)
          color7 :  (string)
          color8 :  (string)
          color9 :  (string)
Attachments
Screen Shot 2018-01-30 at 6.52.21 AM.png
Screen Shot 2018-01-30 at 6.52.21 AM.png (52.83 KiB) Viewed 771 times

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

[My Plugins] - [My Forums]

Posted on
Tue Jan 30, 2018 7:36 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Colorpicker API

Hi Dave,

Sorry, I didn't see your original post a few days ago for some reason. I just looked into it and defaultValue is currently broken. I'll look into getting it fixed. Once fixed, the format will be:

defaultValue="AA BB CC" (where AA is red in hex, BB green, CC blue)

Image

Posted on
Tue Jan 30, 2018 7:50 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Colorpicker API

No problem Matt, thanks! Glad to hear that it's not just me.

No rush, I can work around it.

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 5 guests