Creating device groups without using DeviceFactory UI

Posted on
Fri Aug 07, 2020 7:58 pm
matt (support) offline
Site Admin
User avatar
Posts: 20568
Joined: Jan 27, 2003
Location: Texas

Re: Creating device groups without using DeviceFactory UI

The only way for the subtypes to not show is to define <DeviceFactory> for the UI. I'll add better control over it for non-factory configurations to my ToDo list for the next time I'm in that code.

Image

Posted on
Wed Aug 19, 2020 7:18 am
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Creating device groups without using DeviceFactory UI

I think I know the answer to this already, but wanted to double-check. Is there any way to create a device group from existing plugin devices (add the needed bits to the devices' props), or is the only time to do that at initial creation? I suspect the latter.

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

[My Plugins] - [My Forums]

Posted on
Wed Aug 19, 2020 5:21 pm
matt (support) offline
Site Admin
User avatar
Posts: 20568
Joined: Jan 27, 2003
Location: Texas

Re: Creating device groups without using DeviceFactory UI

Your intuition is correct – currently the only APIs for managing device grouping is during create. I'll add to the API todo list though to extend it so you can group and ungroup post create. The hardest part would be getting the UI (any open device dialogs) to refresh after the operations. If that isn't critical then adding the APIs would be fairly trivial (famous last words).

Image

Posted on
Wed Aug 19, 2020 5:33 pm
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Creating device groups without using DeviceFactory UI

Thanks Matt -- for this particular project, recreating the devices as a group isn't a heavy lift. I do think having the ability would be useful, so thanks in advance if you're able to do it someday.

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

[My Plugins] - [My Forums]

Posted on
Fri Feb 19, 2021 11:32 am
autolog offline
Posts: 3506
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Creating device groups without using DeviceFactory UI

matt (support) wrote:
Your intuition is correct – currently the only APIs for managing device grouping is during create. I'll add to the API todo list though to extend it so you can group and ungroup post create. The hardest part would be getting the UI (any open device dialogs) to refresh after the operations. If that isn't critical then adding the APIs would be fairly trivial (famous last words).

Following up on this, am I correct in thinking that additional devices can be created or removed after the initial creation of the main device. For example, a user selects to create a temperature sensor device and selects temperature and humidity from a list of temperature, humidity and pressure. I can create a temperature device with temperature and humidity which will display nicely in the Indigo UI. A bit later the user decides he wants to include pressure, so could I create a pressure device linked to the master device via grouping? I realise in this case, I could just add a pressure state dynamically, in fact that is what I am doing, but was just trying to keep the example simple. :)

Posted on
Fri Feb 19, 2021 3:40 pm
matt (support) offline
Site Admin
User avatar
Posts: 20568
Joined: Jan 27, 2003
Location: Texas

Re: Creating device groups without using DeviceFactory UI

As long as the <DeviceFactory> ConfigUI is open you can add or remove devices, even after re-entry to the device dialog later. Indigo does this currently when we add Z-Wave device definitions. For example, upon initial sync a single device might be created, but then later when we add a definition for that module it might require multiple devices (ex: multi sensor) in which case the user re-syncs and Indigo will delete/add devices as needed base on the new definition.

Note the Z-Wave plugin tries to be polite if it has to remove devices because of a new device definition (or definition change). First checks to see if those devices have any dependencies (are used in Triggers, Control Pages, etc.), in which case it doesn't do the remove and alerts the user (via Event Log message).

Image

Posted on
Sat Feb 20, 2021 7:40 am
autolog offline
Posts: 3506
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Creating device groups without using DeviceFactory UI

Hi Matt,

So just to be clear, I have got to do a Device Factory setup to be able to add a device to a group after initial main device creation?

What I really want to be able to do is to just tick a check box (e.g. 'Supports Pressure') in the edit device settings for the main device and then for the plugin to automatically create a grouped pressure device linked to the main device when savings the settings. Also for this associated sub-device type not to be listed in the create new device dialogue. So the only way it can be created or deleted is by unticking the e.g. 'Supports Pressure' check box or deleting the main device.

Posted on
Sat Feb 20, 2021 1:55 pm
matt (support) offline
Site Admin
User avatar
Posts: 20568
Joined: Jan 27, 2003
Location: Texas

Re: Creating device groups without using DeviceFactory UI

Yes, currently everything is wired to when the device factory UI dialog is showing. So in this example the Supports Pressure would have to be in the factory UI and not the device settings UI.

I wonder if it would be helpful to have the concept of a child device (device in a group) that is not enabled/visible outside of the Device dialog. That is the tab panel would show in the device dialog for the device but would not show anywhere else in the UI (Main window, triggers, etc.). Then when the device is enabled (via UI or dynamically) it starts showing up everywhere else. Basically, not have the creation/deletion of the device be dynamic, just have its visibility throughout the UI be dynamic. The problem I'm trying to avoid here is the complexity I mentioned earlier we ran into with the Z-Wave plugin, which is what happens when a device is dynamically deleted resulting in dependent Triggers, Schedules, Control Pages, etc., either getting into a bad state or being deleted themselves. The downside of the visibility/enabled approach is that the number and types of devices would have to be static. That is if you have a plugin that can have an arbitrary number of sensors the approach is no longer useful.

Image

Posted on
Sat Feb 20, 2021 2:50 pm
autolog offline
Posts: 3506
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Creating device groups without using DeviceFactory UI

matt (support) wrote:
... I wonder if it would be helpful to have the concept of a child device (device in a group) that is not enabled/visible outside of the Device dialog. ...

I think this suggestion might work for my use case? :)

If I take the temperature sensor, the a device might just have temperature, temperature + humidity or temperature + humidity + pressure. Humidity is currently handled but pressure isn't, so this could be a device to be made visible.

Another example might be an Aeotec multiSensor which has a lot of properties: humidity, motion, battery illuminance, acceleration and temperature
So I could define a multiSensor device with all those sub-devices and just make the ones visible that the user requires.

How difficult is it to do this and I guess it isn't something that would happen in the short term?

In the interim, I can just stick to one device and dynamically create states.

I would be happy to beta test it though! :D

Who is online

Users browsing this forum: No registered users and 3 guests