Changing a plugins device type

Posted on
Thu Jun 09, 2016 8:26 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Changing a plugins device type

What is (or is there) the proper way to change a devices type? I have a plugin that currently defines its device as "custom" but I want to change it to "relay", so I changed the devices.xml appropriately just to see what happened to my existing "custom" devices that were already defined in Indigo and they didn't change (and I honestly didn't expect them to really). Of course if I add a new device it will pick up that its a relay, but the old ones stay at custom.

I tried
Code: Select all
dev.stateListOrDisplayStateIdChanged()
but that didn't do the trick.

Would my only recourse be to, in code, read through my devices and re-create them and then delete the existing ones (again in code)? While not an unsurmountable, yet bulky, way to do it this would not easily take into account other things tied to that device like control pages or action groups.

Again, bulky, but I could pull the device dependencies and try to do it that way but figured there might be a super secret way to do this in my plugin code. Super secret also equates to 'stuff thats in the wiki that I couldn't find because I'm dumb' by the way :).

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu Jun 09, 2016 9:56 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Changing a plugins device type

Take a look at this thread for the API (and technique) you'll want to try. Good luck and note you'll be using an API that doesn't have a ton of QA hours behind it. :twisted: I do believe I've used it a few times though...

Image

Posted on
Thu Jun 09, 2016 10:02 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Changing a plugins device type

Thanks Matt, I'll give that a whirl!

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests