State Key Not Defined

Posted on
Fri Jan 18, 2019 7:11 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

State Key Not Defined

I am trying to up my game on regression testing when posting updates to existing plugins. One thing came up which I can't pin down when testing how the plugin installs from scratch.

Steps to reproduce:
  • Create a copy of the XYZ plugin file called "XYZ Plugin Test".
  • Edit the "XYZ Plugin Test" Info.plist file to make Indigo treat it as an entirely different plugin instance.
  • Make sure there's no indiPref file associated with "XYZ Plugin Test" so that it's installed as a new plugin.
  • Install the plugin and complete configuration as normal.
  • Duplicate an existing device from the "real" XYZ Plugin.
  • Open the device config and change the device type from "XYZ Plugin" to "XYZ Plugin Test". The device model goes to "no device type selected' and I get:

Code: Select all
   Error                           device "ABC" state key onOffState not defined (ignoring update request)

When I reselect the device model, everything works as expected. Device ABC does have the 'onOffState' defined in Devices.xml and in the existing device I copied from. When the new device "ABC Test" cycles, it runs without error. The KeyError above only happens at the point I switch the type. Of course, there are many other device states, but it only KeyErrors on 'onOffState'.

This is likely a low-order thing as a user would never run into it. I just find it curious.

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

[My Plugins] - [My Forums]

Posted on
Fri Jan 18, 2019 4:30 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: State Key Not Defined

I think the problem is more likely you are hitting a buglet that occurs when a device type is changed frpm one plugin to another. I'll see if I can reproduce the problem here with the SDK example relay plugin.

Image

Posted on
Fri Jan 18, 2019 4:49 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: State Key Not Defined

Thanks Matt - one thing that may factor into the equation (that I should've mentioned earlier) is that the key 'onOffState' is also used thusly:

Code: Select all
        <UiDisplayStateId>onOffState</UiDisplayStateId>

That may be why it's singled out.

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

[My Plugins] - [My Forums]

Posted on
Fri Jan 18, 2019 5:10 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: State Key Not Defined

Can you copy/paste the XML <Device> chunk from Devices.xml for the device type that has the problem?

Image

Posted on
Fri Jan 18, 2019 6:42 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: State Key Not Defined

matt (support) wrote:
Can you copy/paste the XML <Device> chunk from Devices.xml for the device type that has the problem?

Sure. It's not just limited to one device type. The xml file is large, so I'll send it by email.

I also noticed after looking at it even more deeply, it seems that both instances of the plugin "XYZ Plugin" and "XYZ Plugin Test" have to be enabled for the error to occur.

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