When is a list not a list?

Posted on
Fri May 08, 2020 4:20 am
howartp offline
Posts: 4083
Joined: Jan 09, 2014
Location: West Yorkshire, UK

When is a list not a list?

I'm designing my Devices.xml for a new plugin and I think i've come across an anomoly.

I have a menu field with three options. When I created the device, it was a menu as you'd expect:

Code: Select all
         <Field type="menu" id="p1DaysOn" defaultValue="7">
            <Label>Period 1 applies:</Label>
            <List>
               <Option value="7">All week</Option>
               <Option value="5">Weekdays only</Option>
               <Option value="2">Weekends only</Option>
            </List>
            <CallbackMethod>p1DaysCALLBACK</CallbackMethod>
         </Field>
Code: Select all
2020-05-08 11:02:18.552   EnergyLink Debug   UiValuesDict : (dict)
     p1DaysOn : 7 (string)
     p1Start : 06:00 (string)
     p2DaysOn :  (string)
     p2Start : 06:00 (string)
In order to screenshot the options, I temporarily changed it from a menu field to a list field.

However, I have now changed the field back to menu, but valuesDict is still giving me a List?

Code: Select all
2020-05-08 11:11:06.940   EnergyLink Debug   UiValuesDict : (dict)
     p1DaysOn : (list)
          Item : 5 (string)
     p1Start : 06:00 (string)
     p2DaysOn : (list)
          Item : 5 (string)
     p2Start : 06:00 (string)

stateListOrDisplayStateIdChanged is called on every deviceStartComm() so should it have changed back to a single string value, not a list of strings?

I can delete the device and recreate it as i'm only in design/creation stage at the moment, but wondered if it's something to add to the buglist or whether it's me doing/expecting something wrong?

Peter

Posted on
Fri May 08, 2020 10:35 am
matt (support) offline
Site Admin
User avatar
Posts: 19960
Joined: Jan 27, 2003
Location: Texas

Re: When is a list not a list?

I'm curious: does it fix itself if you select a different menu item, close the dialog, then re-select the original menu item?

Image

Posted on
Fri May 08, 2020 1:39 pm
howartp offline
Posts: 4083
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: When is a list not a list?

Unfortunately i've deleted the device now and recreated it, but I'm sure I saved device changes between edits whilst I was playing, including picking different values in the menu, to try and get it to go right/wrong.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests