Extending Indigo - Device Details and Color Controls

Posted on
Sun Nov 12, 2017 9:48 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Extending Indigo - Device Details and Color Controls

LightifyDimmerDetails.jpeg
jpeg showing 'Color Controls' and 'Device Details'
LightifyDimmerDetails.jpeg (196.71 KiB) Viewed 2650 times
I am working on a plugin that extends the 'dimmer' device type. I started with the 'Example Device - Relay and Dimmer' plugin. I am trying to figure out how I can extend the info shown on the 'Devices' display - see attached image.

I am able to add new config to the ConfigUI via the Devices.xml file.. I have also added 'States' which show up in the Triggers. But I am not sure how to change these on the device details panel

Any examples or guidance on how I can add both 'Color Controls' and 'Device Details' is appreciated

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Mon Nov 13, 2017 5:02 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Extending Indigo - Device Details and Color Controls

If you are asking how to change the pane you have outlined in red, you can't. I believe that's already on the feature enhancement request list.

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

[My Plugins] - [My Forums]

Posted on
Mon Nov 13, 2017 11:08 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Extending Indigo - Device Details and Color Controls

Note if you pull up the divider (tiny dot above the O in "Osram" above) then it will expand out and show you the custom device states you have added. As Dave mentioned you cannot (currently) add new UI controls to the Color Controls or Device Details views. You can control what values are shown for the existing controls, and you have some controls over which controls are visible though (for example, you can hide the Temp slider and edit field).

Image

Posted on
Mon Nov 13, 2017 1:09 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

Thanks for the replies.

I'll give a look at the divider dot with Custom States.. BTW.. Can this be used for Custom Controls as well?

Also, thought I saw a plugin that had some specific info show in the 'State' column of the Device list of the main indigo window.. Can this list value be overridden?

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Mon Nov 13, 2017 2:15 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Extending Indigo - Device Details and Color Controls

rbdubz3 wrote:
I'll give a look at the divider dot with Custom States.. BTW.. Can this be used for Custom Controls as well?

No, that pane lists all of the available device states. Beyond listing them, it also allows users to be able to right-click on any state and get useful information like the python reference to the state.

Also, thought I saw a plugin that had some specific info show in the 'State' column of the Device list of the main indigo window.. Can this list value be overridden?

Yes, a plugin can change that value for the devices that it owns. Here's how I do it with the WUnderground plugin:

Code: Select all
# API v1.x -- You update each state value individually
dev.updateStateOnServer('onOffState', value=True, uiValue= display_value)

# API 2.x -- You can add many device state value changes to the list and update them all at once.
weather_states_list = []
weather_states_list.append({'key': 'onOffState', 'value': True, 'uiValue': display_value})
dev.updateStatesOnServer(weather_states_list)

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

[My Plugins] - [My Forums]

Posted on
Tue Nov 14, 2017 9:40 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

Thanks Dave!

Do you know if it is also possible to dynamically update the icons and text shown in the 'State' column of the device browser? I found some chatter on an older archived post. However, I was hoping I could update the icon in the list based on my custom state (not sure if this will work for a device that extends the indigo dimmer)

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Tue Nov 14, 2017 7:57 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Extending Indigo - Device Details and Color Controls

rbdubz3 wrote:
Thanks Dave!

Do you know if it is also possible to dynamically update the icons and text shown in the 'State' column of the device browser? I found some chatter on an older archived post. However, I was hoping I could update the icon in the list based on my custom state (not sure if this will work for a device that extends the indigo dimmer)

It is!

Screen Shot 2017-11-14 at 7.52.51 PM.png
Screen Shot 2017-11-14 at 7.52.51 PM.png (9.85 KiB) Viewed 2468 times


You can change the icon using this method.

Code: Select all
indigo.server.log("state image selector: " + str(dev.displayStateImageSel))

dev.updateStateImageOnServer(indigo.kStateImageSel.SprinklerOff)
dev.updateStateImageOnServer(indigo.kStateImageSel.SprinklerOn)
dev.updateStateImageOnServer(indigo.kStateImageSel.HvacCooling)
dev.updateStateImageOnServer(indigo.kStateImageSel.PowerOn)
dev.updateStateImageOnServer(indigo.kStateImageSel.SensorOn)
dev.updateStateImageOnServer(indigo.kStateImageSel.TimerOn)

There is a placeholder for custom images to be displayed using this API callback, but they have not been turned on yet. As a result, you can only use the images explicitly listed in the API docs referenced above.

Please ping back if you have any questions.

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

[My Plugins] - [My Forums]

Posted on
Wed Nov 15, 2017 9:53 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

Ah nice.. that worked for me. Thanks Dave

So last question(s) on this stuff..
1) Can I override the text shown in the status list.. - similar to the first item in the attached image - reads 'up 2017-11-14xxxxx'. Not sure if there is anything specific for one of my own device types that extends 'dimmerType'
2) Is it possible to clear out these list display values? For example, in the attached image I updated the icon to the 'green circle (LightSensorOn)'. Can this be reset back to the default of lightbulb on/off? I tried re-starting my indigo process but it seems like this icon value is persisted somewhere.. Maybe I need to delete and re-create the entire device

thanks in advance
Attachments
deviceliststring.jpeg
image of status list for display of devices
deviceliststring.jpeg (117.34 KiB) Viewed 2428 times

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Wed Nov 15, 2017 10:05 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

Think I found the answer to my question #1 for overriding the status text in that column...
Gonna try 'UiDisplayStateId' property in devices.xml :

<UiDisplayStateId>statusDisplay</UiDisplayStateId>

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Wed Nov 15, 2017 10:20 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

My attempt didn't work :(. After trying the 'UiDisplayStateId' in my Devices.xml , I followed it up with the following python code in my plugin.py

Code: Select all
indigoDevice.updateStateOnServer("statusDisplay", "CircAuto:OFF")


That appeared to update the state value just fine, but I was expecting it to also be updated in the 'State' list column.. Maybe it is an issue for this device that extends 'dimmerType'?

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Wed Nov 15, 2017 7:38 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Extending Indigo - Device Details and Color Controls

rbdubz3 wrote:
Code: Select all
indigoDevice.updateStateOnServer("statusDisplay", "CircAuto:OFF")


That appeared to update the state value just fine, but I was expecting it to also be updated in the 'State' list column.. Maybe it is an issue for this device that extends 'dimmerType'?

The updateStateOnServer method will update the custom device state on the device; I usually use the 'onOffState' state for my custom values that I display in the UI. Here's an example of a complete set of code statements to control the display for one device in the UI (for API v1.x):

Code: Select all
dev.updateStateOnServer('onOffState', value=True, uiValue='43 ºF')
dev.updateStateImageOnServer(indigo.kStateImageSel.TemperatureSensorOn)
Attachments
Screen Shot 2017-11-15 at 7.37.42 PM.png
Screen Shot 2017-11-15 at 7.37.42 PM.png (8.19 KiB) Viewed 2374 times

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

[My Plugins] - [My Forums]

Posted on
Thu Nov 16, 2017 10:11 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

Thanks for answering my questions Dave.. So I found a workaround to update the text in the list of devices.. Since my custom plugin extends a 'dimmer' device type, I need to update the uiValue of the state 'brightnessLevel'

Code: Select all
indigoDevice.updateStateOnServer("brightnessLevel", value=indigoDevice.states['brightnessLevel'], uiValue="CircAuto:ON".ljust(5) + str(indigoDevice.states['brightnessLevel']))


after updating uiValue for brightnessLevel, it shows my preferred text.. I did scan some code from the 'fingscan' plugin which was also updating the text in the list of devices.. In that plugin, the Devices.xml property defines 'UiDisplayStateId', which I am pretty sure shows that specific state variable in the list of devices.. Below is what I tried

Code: Select all
                 <UiDisplayStateId>statusDisplay</UiDisplayStateId>
                <States>
                        <State id="statusDisplay">
                                <ValueType>String</ValueType>
                                <TriggerLabel>statusDisplay</TriggerLabel>
                                <ControlPageLabel>statusDisplay</ControlPageLabel>
                        </State>
                        <State id="circadianEnabled">
                                        <ValueType>Boolean</ValueType>
                                        <TriggerLabel>Circadian Enabled</TriggerLabel>
                                        <ControlPageLabel>Circadian Enabled</ControlPageLabel>
                        </State>
                </States>


The above didn't work for me, and I had to set uiValue for 'brightnessLevel' .. So my guess is that UiDisplayStateId only works for a true custom plugin?

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

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

Re: Extending Indigo - Device Details and Color Controls

rbdubz3 wrote:
So my guess is that UiDisplayStateId only works for a true custom plugin?

That is correct, it has to be a custom type to override/specify (via UiDisplayStateId) which stateId is used for the main status column in the UI. The dimmer, relay, thermostat, and sprinkler types are all coded to only show a specific state.

Image

Posted on
Thu Nov 16, 2017 2:29 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Extending Indigo - Device Details and Color Controls

ok cool.. Thanks Matt.. I think i have an understanding of what I need now.

Planning to publish my first plugin soon. Hopefully the market for it isn't totally dead.
High level features:
- Support for Osram Lightify Zigbee Hub - this uses a native python library to manipulate colors/temp/brightness/onoff state
- Leverages Osram Lightify Group - supports configuration of multiple bulbs simultaneously as a group
- Supports custom 'Circadian' mode - the group of lights will automatically change color temperature and brightness throughout the day in accordance with circadian light - i.e. late night it will be orange/yellow and dim, midday it will be white/blue and bright, and it will transition during sunrise/sunset times..

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Fri Nov 17, 2017 11:28 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Extending Indigo - Device Details and Color Controls

Sounds good – looking forward to seeing it posted!

Image

Who is online

Users browsing this forum: No registered users and 2 guests