which state is shown in column State

Posted on
Fri Nov 24, 2017 10:28 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

which state is shown in column State

really need help here, have been looking at the code for 2 days and I can not figure out what I am doing wrong.

I want to change which device state is shown in column State in the main window.


1. in devices.xml
changed UiDisplayStateId
Code: Select all
    <Device type="custom" id="beacon">
      <Name>beacon</Name>
        <UiDisplayStateId>displayStatus</UiDisplayStateId>
        <ConfigUI>           
to to show displayStatus in the state column
and added the proper state
Code: Select all
      <States>
            <State id="displayStatus">
                <ValueType>String</ValueType>
                <TriggerLabel>displayStatus</TriggerLabel>
                <ControlPageLabel>displayStatus</ControlPageLabel>
            </State>
...
</States>

2. added in plugin
Code: Select all
 def deviceStartComm(self):
    dev.stateListOrDisplayStateIdChanged()

to force indigo to update state and display refs.

The device states changes as designed, but indigo still shows the old state (Status) in the state column..

Have done edit / save device, restarted indigo, removed/ added device.... still showing the old state.

I am trying to replicate something I am doing in other plugins and it works fine there ,but not in this plugin..

Any idea where I could look? Any method I should / must not call .. ?

Karl

ps posting the code here would not make sense .. it is 13 k lines long

Posted on
Fri Nov 24, 2017 9:59 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: which state is shown in column State

The only difference I could find is that in the plugins where it works all the UiDisplayStateId defs are the same. In the one that does not work there are 2 defs:

3 of:
<UiDisplayStateId>displayStatus</UiDisplayStateId>
and about 20 of :
<UiDisplayStateId>status</UiDisplayStateId>

it always takes only: status

Karl

Posted on
Fri Nov 24, 2017 10:42 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: which state is shown in column State

also tried:
Code: Select all
    def getDeviceDisplayStateId(self,dev):
        if u"displayStatus" in dev.states: return  dev.states[u"displayStatus"]
        else:                              return  dev.states[u"status"]
and
Code: Select all
    def getDeviceDisplayStateId(self,dev):
        if u"displayStatus" in dev.states: return  u"displayStatus"
        else:                              return  u"status"


no change still only shows the "status" state

Posted on
Fri Nov 24, 2017 10:47 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: which state is shown in column State

:oops: :oops: :oops: :oops: :oops: :oops:

I had 2 of these in the code:
def getDeviceDisplayStateId(self, dev):

the last one overwrote the first one.. -- added that a year ago

indigo is always right ...


CASE CLOSED .. after 3 days of debugging

Karl

Posted on
Sat Nov 25, 2017 3:26 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: which state is shown in column State

Hi Karl – I'm glad you tracked down the problem and have it working now. :)

Image

Posted on
Sat Nov 25, 2017 9:28 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: which state is shown in column State

after 2 + days I was doubting myself ..

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests