Page 1 of 1

Append/Remove device from Device Group programmatically

PostPosted: Sun Dec 08, 2019 12:47 pm
by cesarvog
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

Re: Append/Remove device from Device Group programmatically

PostPosted: Sun Dec 08, 2019 1:43 pm
by FlyingDiver
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.

Re: Append/Remove device from Device Group programmatically

PostPosted: Sun Dec 08, 2019 2:46 pm
by howartp
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

Re: Append/Remove device from Device Group programmatically

PostPosted: Sun Dec 08, 2019 3:21 pm
by cesarvog
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

Re: Append/Remove device from Device Group programmatically

PostPosted: Mon Dec 09, 2019 10:05 am
by jay (support)
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.

Re: Append/Remove device from Device Group programmatically

PostPosted: Tue Dec 10, 2019 8:38 am
by cesarvog
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:

Re: Append/Remove device from Device Group programmatically

PostPosted: Tue Dec 10, 2019 2:24 pm
by jay (support)
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