[ANSWERED]: Possible to define plugin grouped device?

Posted on
Wed Nov 26, 2014 11:30 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

[ANSWERED]: Possible to define plugin grouped device?

Is it possible to define a grouped device for a plugin and if so how ?

I am looking to define up to two devices for a Smappee, one for energy usage and one for solar generation.

This leads to a second question, is it possible to modify the displayed text for a Device (in the Device Details pane) as follows:
Current load becomes Current generation
Total Usage becomes Total generation

If not possible, I guess it becomes a feature request to add to the ever expanding list :)
Last edited by autolog on Sat Dec 06, 2014 3:16 pm, edited 6 times in total.

Posted on
Wed Nov 26, 2014 2:17 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Possible to define plugin grouped device?

I'm not following what you mean by grouped device, can you elaborate?

You can't change those because they are energy usage (and built-in) states. You can, of course, add your own custom states. That would be the right approach.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Nov 26, 2014 4:27 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

By a grouped device, I mean something like a Fibaro FGMS001 which has Luminance, Motion, Tamper and Temperature in one device which Indigo shows as four separate devices but are listed as group when using indigo.device.getGroupList() i.e. there is a main device and slave devices. I would like to be able to emulate this for a plugin device, if possible. :)

Posted on
Wed Nov 26, 2014 4:39 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Possible to define plugin grouped device?

See the Example Device - Factory plugin that is part of the Indigo SDK.

Image

Posted on
Wed Nov 26, 2014 4:53 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

matt (support) wrote:
See the Example Device - Factory plugin that is part of the Indigo SDK.
Just what I was looking for :D

Thanks for the pointer :)

Posted on
Thu Nov 27, 2014 7:18 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: [ANSWERED]: Possible to define plugin grouped device?

I have looked at the DeviceFactory (documentation and SDK) and I am not sure this can do what I want. It seems from the documentation that the creation of the grouped devices are user driven i.e. a dialogue is presented where they select the devices to create and group (as per the SDK example). I want to automatically create a grouped device when creating the Smappee energy meter and this requires no user input.

So the question is, when I query the Smappee and get the info back from the Smappee, how do I programmatically create a Factory Device without the user being presented with a menu or having to press the 'new...' device button.

Also, is it possible to have the devices.xml contain a mixture of factory and non-factory device. I want to be able to have a factory device for energy usage and solar generation but individual devices for smappee appliances (oven, microwave etc) and smappee plugs.

Thanks for any guidance :)

Posted on
Thu Nov 27, 2014 10:39 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Possible to define plugin grouped device?

Hi Jon,

Stopping and starting of the factory grouping state is driven by the device UI. Can the flow not be:

1) User creates new Indigo Device.
2) User selects Smappee energy meter type, which shows the config UI for the factory dialog.
3) User specifies the SMappee energy meter address (IP address?), and presses "Sync."
4) Your logic connects to it, creates however many grouped devices it needs.

That is the recommended user flow at this point – the device dialog is the location the user goes when they want to add/sync/link any devices into Indigo.

You can have a combination of factory and simple device types defined the XML.

Image

Posted on
Fri Nov 28, 2014 1:09 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: [ANSWERED]: Possible to define plugin grouped device?

Hi Matt,
I changed my logic flow and now have the Smappee factory device set-up. :D
I am just working through and amending my code to take account of two linked devices rather than one.

Thanks for your help. :)

Posted on
Fri Dec 05, 2014 2:57 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

matt (support) wrote:
... You can have a combination of factory and simple device types defined the XML.

Hi Matt,
I am trying to work out how to differentiate in the xml between devices that are to included in the factory device and devices that aren't. In the xml, the <DeviceFactory> is at the same level as the <Device>. When I click on 'New...' it offers me the opportunity to select 'Autolog Smappee'. As soon as I select this it launches the Device Factory dialogue rather than letting me select a model and then the Device Factory dialogue if appropriate.

The Smappee provides usage(consumption) and solar(generation) figures - I have set this up as a Factory Device. The Smappee also monitors individual appliances, which can be a large number (I currently have 34 identified). I want to be able to add these in as simple (non-factory) devices. It can also control so called 'comfort plugs' and again you could have any number of these.

How do I set these up so that they appear as simple devices as it isn't practical to include them in the Factory Device as the UI overflows:
smappee factory device question.png
Smappee
smappee factory device question.png (63.83 KiB) Viewed 4011 times

I could rework my Device Factory dialogue to only allow individual appliance devices to be defined but I also want to be able to create the Smappee Appliance devices automatically (via a user selected option) when creating the Smappee Usage/Solar factory device but I can't see a way to prevent them being included in the Smappee Usage/Solar factory device.

I am obviously missing something :?

Posted on
Sat Dec 06, 2014 7:09 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

Bumping this question in case it got missed :?: :)

Posted on
Sat Dec 06, 2014 12:10 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Possible to define plugin grouped device?

Hi Jon,

Currently if you have <DeviceFactory> used in your XML at all then the Indigo UI switches to the factory UI mode and it isn't possible to show selected non-factory types in the main device dialog. Changing this is a reasonable/good request, but it isn't straightforward/trivial change so it'll have to go on the feature request list.

The workaround is to add your own Type menu to your device factory configUi and handle the management of it in your plugin. So you would have logic that adds a single device of the selected type when it is a simple type, or does the more complex logic of adding N devices when the type selected is one where you want multiple devices grouped. From a user experience perspective it should work okay – the Type menu for the Smappee devices will just be inside the factory ConfigUI dialog instead of the main device dialog.

Note you will still have the individual <Device> elems in the XML and their ConfigUI is still used when the Edit Device Settings... button is pressed. The only annoying part is that once a type is selected the only way to change it is to either delete the device or press the Define and Sync... button to get back into the factory configUI where your Type menu will exist.

Image

Posted on
Sat Dec 06, 2014 12:45 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

Hi Matt,
I think I can manage that but I am still struggling with how to prevent the devices being grouped. The plugin has an info.plist which has a CFBundleDisplayName of 'Autolog Smappee' - I think this is what is being displayed in the Create New Device dialogue Type field. So I select this and get launched into the Define Device Group dialogue. So I can see that I can add "Type" processing in here to handle the different device types defined in the xml. The problem is that ideally I want to be able to create more than one device (i.e. I would like to create say 34 individual appliance devices automatically), how do I prevent them being grouped in one device.

As soon as I do a indigo.device.create it groups it together with any previously created device in this invocation of the new processing (or edit processing for that matter).

If this isn't possible I will have to make it so that the appliances are set-up one at a time which could be a bit labourious but doable :)

Posted on
Sat Dec 06, 2014 1:09 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Possible to define plugin grouped device?

Ah, I see. You are trying to automatically create a bunch of ungrouped devices. Yeah, whenever the factory UI is showing any indigo.device.create() calls will result in grouped devices. There is no way around that (currently). The only workaround I can think of, if you want to auto create all the devices (versus having the user manually create each one), would be to do it via a menu item (so the factory UI wouldn't be visible).

guess another option, which is a hack but might work, would be to set an internal plugin pref state "autoCreateDevices" inside the factory configUI dialog (as the result of a button press or something?), then have the plugin check for that preference later – after the factory UI is closed – and create the devices at that time.

Image

Posted on
Sat Dec 06, 2014 3:15 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to define plugin grouped device?

OK - thanks for the advice - I am sure I will be able to work with one of the suggested solutions :D

Posted on
Wed Jan 14, 2015 2:30 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [ANSWERED]: Possible to define plugin grouped device?

Can I piggyback on this thread? I have a question that--while related--is different from Jon's I think. Is it possible to use the Device Factory to create a grouped device where there is no user interaction beyond creating their initial device? I'll give you an example.

In working on the OWServer plugin, I'm working on a custom device which presents like a multisensor (in this case temperature, humidity, barometric pressure, and light) and I'd like to present that in the same way that Indigo presents multisensors that are natively supported. Otherwise, it requires me to call it a sensor and use my best judgment as towhich value to present as the sensorValue.

Thanks,
Dave

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 2 guests