DEVICE.XML checkbox

Posted on
Fri Mar 03, 2017 4:07 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

DEVICE.XML checkbox

DEVICE.XML

when I switch from a menu / list selection (0/1) to a checkbox(true/false) for an existing device the resulting valuesDict paramter is always integer 0

Code: Select all
<Field id="memberOfFamily" type="menu"   defaultValue="0">
    <Label>Member of Family:</Label> 
    <List>
        <Option value="0"   > no</Option>
        <Option value="1"   > yes</Option>
    </List>
</Field>

to
Code: Select all
<Field id="memberOfFamily" type="checkbox"   defaultValue="false">
    <Label>Member of Family:</Label> 
</Field>

I also tried default = "1" or "0" or "true" ..
In validateDeviceConfigUi():
I always get:
Code: Select all
...
     memberOfFamily : 0 (integer)
...
with indigo.server.log(unicode(valuesDict))

any advice?

Karl

Posted on
Fri Mar 03, 2017 5:26 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: DEVICE.XML checkbox

defaultValue is never used when there's an existing value in valuesDict - it's only used when there is no existing value. You'll need to convert the value yourself to the appropriate boolean value from the previous integer value, probably in deviceStartComm(). We don't attempt to do any conversion of existing data so when a value type changes it's up to you to "fix" it.

[MODERATOR NOTE] moved to the correct forum and fixed the XML formatting to improve readability.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 28 guests

cron