Extensibility feedback for custom devices

Posted on
Mon Mar 10, 2014 4:59 am
orangy offline
Posts: 8
Joined: Feb 03, 2014

Extensibility feedback for custom devices

Hi,

I'm playing with Indigo extensibility, and I've got Richard Perlman's Netatmo plugin as my playground. As agreed with Richard, I've published it here: https://github.com/orangy/indigo.netatmo

Here is what I find missing/problematic/unclear:

* Hidden fields needs some attention in docs. I've found them in some plugin, and some conventions around them are not clear from docs:
Code: Select all
            <Field type="checkbox" id="SupportsBatteryLevel" hidden="true" defaultValue="true"/>
            <Field type="checkbox" id="SupportsSensorValue"  hidden="true" defaultValue="true"/>
            <Field type="checkbox" id="SupportsOnState"  hidden="true" defaultValue="false"/>

Moreover, batteryLevel does work by convention, i.e. if I provide SupportsBatteryLevel and publish batteryLevel state, it shows in UI, even if device type is 'custom'. For sensorValue it doesn't work this way, requires 'sensor' device type.

* Some device data is not refreshed when reloading plugin, not yet sure which. When I update States list and reload plugin, it still won't accept these states in 'updateStateOnServer', I have to recreate devices and/or restart server.

* It would be nice to watch changes in plugin directory and reload plugin automatically, when Indigo client becomes active. Would save a lot of time debugging. Could be an option in Plugins page in preferences.

* How do you define custom multisensor? I have one for z-wave aeon multisensor and it has several pages in device settings. I would like to have similar thing in Netatmo plugin.

* Device Details could be configurable from States dictionary, by using 'uiValue' in 'updateStateOnServer', and providing control type in States like this:
Code: Select all
<State id="Temperature">
                <ValueType>Float</ValueType>
                <ValueControl>Text</ValueControl> <!-- Display as simple text -->
                <TriggerLabel>Temperature</TriggerLabel>
                <ControlPageLabel>Temperature</ControlPageLabel>
            </State>

Could have Text, On/Off (red/green circle), Percentage (like battery), Image Set (for enum values), etc. May also need <ValueLabel> field for text label in Device Details.
Will be much better than current "Custom States" list, which I found only accidentaly, cause it is hidden in default UI configuration.

* Device Controls could also be customisable from Devices.xml, so that I can add custom buttons and respond to custom actions in plugin.

* RESTful APIs are limited. I can't see folders there, don't see a way to get device current states.

Thank you for this wonderful playground for Home Automation, I have so much fun extending it :) Hope these issues can be solved/improved.

Posted on
Mon Mar 10, 2014 8:17 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Extensibility feedback for custom devices

orangy wrote:
Hidden fields needs some attention in docs. I've found them in some plugin, and some conventions around them are not clear from docs:
Code: Select all
            <Field type="checkbox" id="SupportsBatteryLevel" hidden="true" defaultValue="true"/>
            <Field type="checkbox" id="SupportsSensorValue"  hidden="true" defaultValue="true"/>
            <Field type="checkbox" id="SupportsOnState"  hidden="true" defaultValue="false"/>

Moreover, batteryLevel does work by convention, i.e. if I provide SupportsBatteryLevel and publish batteryLevel state, it shows in UI, even if device type is 'custom'. For sensorValue it doesn't work this way, requires 'sensor' device type.

The docs definitely need some work for these properties. In the mean time take a look at the Indigo SDK example plugins. There are examples of all the main device types and the XML documents all (or at least most) of the properties.

Regarding your example above, batteryLevel is a property of the base device class so any device type can have a battery level (if SupportsBatteryLevel is true). sensorValue is only a property of devices that are of type sensor, thus SupportsSensorValue only applies to that type (sensors can have either or both a binary onState or a numerical sensorValue). The SDK example plugin for sensors illustrates how it works.

Note also you don't have to use hidden fields in XML to set these properties. You can also dynamically change them by updating the device's pluginProps dict for that key instead. Adding them as hidden properties in the XML is just a way to default to having a particular property value.

orangy wrote:
Some device data is not refreshed when reloading plugin, not yet sure which. When I update States list and reload plugin, it still won't accept these states in 'updateStateOnServer', I have to recreate devices and/or restart server.

The state information is stored in the database and Indigo has to be told if the state definition changes after device creation. You can do this via calling the dev.stateListOrDisplayStateIdChanged() method. Opening and saving out of the device settings dialog will also pull down the latest state information from the plugin (into Indigo's database).

orangy wrote:
It would be nice to watch changes in plugin directory and reload plugin automatically, when Indigo client becomes active. Would save a lot of time debugging. Could be an option in Plugins page in preferences.

I don't believe I want to try to make it that smart. I personally wouldn't want a plugin to be reloaded every time I make an edit and I switch to the client. Read over some of the dev tips and practices on this thread though for some alternative ideas. I use Sublime and have it configured so a CMD+B reloads the plugin.

orangy wrote:
How do you define custom multisensor? I have one for z-wave aeon multisensor and it has several pages in device settings. I would like to have similar thing in Netatmo plugin.

To create a device grouping see the factory example in the SDK mentioned above.

orangy wrote:
Device Details could be configurable from States dictionary, by using 'uiValue' in 'updateStateOnServer', and providing control type in States like... Could have Text, On/Off (red/green circle), Percentage (like battery), Image Set (for enum values), etc. May also need <ValueLabel> field for text label in Device Details.
Will be much better than current "Custom States" list, which I found only accidentaly, cause it is hidden in default UI configuration.

We have plans to improve plugin device details definition and UI.
orangy wrote:
Device Controls could also be customisable from Devices.xml, so that I can add custom buttons and respond to custom actions in plugin.

We also have plans to improve plugin device controls definition and UI. ;-)

orangy wrote:
RESTful APIs are limited. I can't see folders there, don't see a way to get device current states.

We have plans to significantly improve the RESTful API. Currently, Indigo's Web Server is built on an older Indigo Server communication layer. Once we update that to run on top of the IndigoPluginHost, which is what all plugins use under the hood, it will be much easier to expose the Indigo object model via RESTful APIs.

Thanks for the feedback and suggestions.

Image

Posted on
Mon Mar 10, 2014 9:36 am
jay (support) offline
Site Admin
User avatar
Posts: 18223
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Extensibility feedback for custom devices

[MODERATOR NOTE] Moved to the appropriate forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests