State with enumeration

Posted on
Thu Nov 07, 2013 12:15 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

State with enumeration

Hello,

This how a state with an enumeration is defined :
Code: Select all
         <State id="operatingStatus">
            <ValueType>
               <List>
                  <Option value="idle">Idle</Option>
                  <Option value="filtration">Filtration</Option>
                  <Option value="temperature">Temp. Update</Option>
               </List>
            </ValueType>
            <TriggerLabel>Operating Status</TriggerLabel>
            <ControlPageLabel>Operating Status</ControlPageLabel>
         </State>


and this is how it appears in the trigger UI :
Image

Is there a bug or something is wrong in my enumeration definition ?

Julien

Posted on
Thu Nov 07, 2013 2:55 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: State with enumeration

Is that state ID (operatingStatus) used somewhere else in the XML file?

Where are those other states coming from? They aren't from Indigo so I would expect them to be in your XML file somewhere (or they could be added at runtime in your .py code as well).

Image

Posted on
Thu Nov 07, 2013 3:11 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: State with enumeration

No, the XML file define only one device type, so this ID is used only once.

The others states come from the XML file. This is the global states definition :
Code: Select all
      <States>
         <State id="operatingStatus">
            <ValueType>
               <List>
                  <Option value="idle">Idle</Option>
                  <Option value="filtration">Filtration</Option>
                  <Option value="temperature">Temp. Update</Option>
               </List>
            </ValueType>
            <TriggerLabel>Operating Status</TriggerLabel>
            <ControlPageLabel>Operating Status</ControlPageLabel>
         </State>
         <State id="mode">
            <ValueType>
               <List>
                  <Option value="off">Off</Option>
                  <Option value="normal">Normal</Option>
                  <Option value="eco">Eco</Option>
                  <Option value="frost">Frost Protection</Option>
               </List>
            </ValueType>
            <TriggerLabel>Mode</TriggerLabel>
            <ControlPageLabel>Mode</ControlPageLabel>
         </State>
         <State id="cycleDuration">
            <ValueType>Number</ValueType>
            <TriggerLabel>Cycle Duration</TriggerLabel>
            <ControlPageLabel>Cycle Duration</ControlPageLabel>
         </State>
      </States>


Julien

Posted on
Thu Nov 07, 2013 3:23 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: State with enumeration

For enumerated lists like that you need the prefix elements as well:

Code: Select all
        <TriggerLabelPrefix>Operating Status Changed to</TriggerLabelPrefix>
        <ControlPageLabelPrefix>Operating Status is</ControlPageLabelPrefix>


along with the labels.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Nov 08, 2013 1:25 am
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: State with enumeration

Thanks Jay. I added the prefix elements (see code below).
Code: Select all
      <States>
         <State id="operatingStatus">
            <ValueType>
               <List>
                  <Option value="idle">Idle</Option>
                  <Option value="filtration">Filtration</Option>
                  <Option value="temperature">Temp. Update</Option>
               </List>
            </ValueType>
            <TriggerLabel>Operating Status</TriggerLabel>
            <ControlPageLabel>Operating Status</ControlPageLabel>
            <TriggerLabelPrefix>Operating Status Changed to</TriggerLabelPrefix>
            <ControlPageLabelPrefix>Operating Status is</ControlPageLabelPrefix>
         </State>
         <State id="mode">
            <ValueType>
               <List>
                  <Option value="off">Off</Option>
                  <Option value="normal">Normal</Option>
                  <Option value="eco">Eco</Option>
                  <Option value="frost">Frost Protection</Option>
               </List>
            </ValueType>
            <TriggerLabel>Mode</TriggerLabel>
            <ControlPageLabel>Mode</ControlPageLabel>
            <TriggerLabelPrefix>Mode Changed to</TriggerLabelPrefix>
            <ControlPageLabelPrefix>Mode is</ControlPageLabelPrefix>
         </State>
         <State id="cycleDuration">
            <ValueType>Number</ValueType>
            <TriggerLabel>Cycle Duration</TriggerLabel>
            <ControlPageLabel>Cycle Duration</ControlPageLabel>
         </State>
      </States>


But the result is identical (see the updated screenshot) regarding the issue.

Julien

Posted on
Fri Nov 08, 2013 5:19 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: State with enumeration

Really? That's exactly how it's supposed to work. Use "Operating Status Changed" or something for TriggerLabel - when defining a trigger on that state and you pick the first one ("Operating Status") what it really means is that any time the state changes (regardless of the change). Then we prepend the prefix to the value to create triggers for when the state becomes each option.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Nov 09, 2013 1:47 am
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: State with enumeration

Ahhh OK :oops:
I didn't understand that's the normal way of working ...
So my issue is resolved !
Thanks Jay.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests