Page 1 of 1

Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 6:48 pm
by hdfreak
Can variables be used in simple fields in place of a value? I've tried putting a variable value in the Sonos Volume action (as an example) and it doesn't work. Tried using a $ and quotes to indicate that it's a variable.

I did look in the documentation and it seems to always lead to scripting.

Thanks for any assistance.

Brian

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 7:23 pm
by DaveL17
Hi Brian -

It depends. Some plugins allow this type of approach while others don't. For example, the "Cynical Denon" plugin allows users to use expressions within its settings. The "Growl plugin" allows you to place values into certain fields. This is not universal behavior, however.

Dave

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 8:36 pm
by hdfreak
Thanks for the reply. When they are allowed, how are they differentiated? Or do you just use straight variable name?

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 8:53 pm
by DaveL17
Unfortunately, there's no standard answer. It's all in how the author decides to implement it. Here are two examples (one is a formula example and the other is a device state or variable value substitution example):

1. In the Cynical Denon plugin, I have buttons on a control page to control volume in a couple of different ways. The Denon works with volume in half db increments. So my volume up and volume down buttons use the following formula =device.volume-1 and then I have another set linked to =device.volume-10 (there are also corresponding +1 and +10 increments.)

2. In the Growl plugin, you can use variable values or device states by inserting %%v:VARIABLEID%% or %%d:DEVICEID:STATEKEY%% into the notification field.

Hope that helps,
Dave

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 8:57 pm
by hdfreak
It does help--thanks again. I'll dig a little deeper into the Sonos plugin and see if there's support for variables.

I came from a ISY-994 and I'm having a blast with how much more I can do with Indigo.

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 9:03 pm
by DaveL17
hdfreak wrote:
I came from a ISY-994 and I'm having a blast with how much more I can do with Indigo.


I am going to need a 12-step program before long. :D
Dave

Re: Variable Use in Simple Fields

PostPosted: Sun Jan 04, 2015 11:01 pm
by jay (support)
All of the built-in plugins that support the method in #2 above have it documented in the config dialog in which the field resides. I encourage 3rd party developers to do the same so that it's clear to the user. That substitution method is provided to all plugins with very little work on the developer's part as part of the API - so it is standard if used... :)