Append/Remove device from Device Group programmatically

Posted on
Sun Dec 08, 2019 12:47 pm
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Append/Remove device from Device Group programmatically

Hello everyone,

I'm wondering if it would be possible to include or remove a device from a Device Group (virtual device) by using an Action Group python script.

I've seen some examples of how to iterate through a list (array) that gets populated with the devices inside a device group and how to append a new device to such a list, but since I'm no programmer by trade, I have no idea on how to subsequently commit that changed array back to the device group it represents.

The idea here is to have a virtual device group containing a group of sensor devices and being able to "activate" or "deactivate" Sensor X by inserting/removing it from the device group.

I've been achieving the desired result by enabling / desabling Sensor X programmatically, but I'm in doubt if this is the best approach because I'm afraid having a z-wave sensor disabled for longer periods my impact my z-wave mesh network.

I hope I was able to explain what I mean above. If not, please do not hesitate to ask and I will try to clarify.

TIA
Cesar Guimaraes

Posted on
Sun Dec 08, 2019 1:43 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Append/Remove device from Device Group programmatically

cesarvog wrote:
I've been achieving the desired result by enabling / desabling Sensor X programmatically, but I'm in doubt if this is the best approach because I'm afraid having a z-wave sensor disabled for longer periods my impact my z-wave mesh network.


Disabling the sensor in Indigo doesn't physically disable the sensor. It just turns off the communication to/from Indigo. So if the sensor is part of the mesh, that's not going to change. At least, that's my understanding of Z-wave.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Dec 08, 2019 2:46 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Append/Remove device from Device Group programmatically

Agreed.

The sensor will even still send info to Indigo, eg temperature or motion, but Indigo will ignore it.


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Dec 08, 2019 3:21 pm
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Append/Remove device from Device Group programmatically

Thanks both Joe and Howard for your fast replies.

With that in mind, I guess I can leave my current solution as is, as that will not impact my mesh network in any way. Sweet!

I wish you both and everyone else here, including Matt and Jay, Happy Holidays.

Cesar Guimaraes

Posted on
Mon Dec 09, 2019 10:05 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Append/Remove device from Device Group programmatically

All of the advice above is good. There is, however, one thing you have to consider: how do you have the device group's ON state defined? An ANY group will become ON when any device is on, so when you disable in Indigo, if the state of the sensor is ON the group will continue to be ON. And the corollary for ALL groups and devices that are OFF when disabled.

I'll add a feature request to have disabled devices ignored in a Device Group, though I probably want to think about it before implementing to make sure we don't accidentally cause other unexpected issues with that approach.

To specifically address the scripting issue, only the plugin/interface that "owns" a device can modify it unless the plugin/interface explicitly provides a way to modify it (though actions/api). I'll add another feature request to add an API action to add/remove devices from a group.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 10, 2019 8:38 am
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Append/Remove device from Device Group programmatically

Thanks Jay, much appreciated.

The ability to execute "Client Actions" (like having the client display control page Y) in Action Groups would also be super nice. :wink:

Posted on
Tue Dec 10, 2019 2:24 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Append/Remove device from Device Group programmatically

cesarvog wrote:
The ability to execute "Client Actions" (like having the client display control page Y) in Action Groups would also be super nice. :wink:


That's also on the request list... :D

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests