Variable Use in Simple Fields

Posted on
Sun Jan 04, 2015 6:48 pm
hdfreak offline
Posts: 19
Joined: Jan 01, 2015

Variable Use in Simple Fields

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

Posted on
Sun Jan 04, 2015 7:23 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Variable Use in Simple Fields

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

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 04, 2015 8:36 pm
hdfreak offline
Posts: 19
Joined: Jan 01, 2015

Re: Variable Use in Simple Fields

Thanks for the reply. When they are allowed, how are they differentiated? Or do you just use straight variable name?

Posted on
Sun Jan 04, 2015 8:53 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Variable Use in Simple Fields

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
Last edited by DaveL17 on Mon Jan 05, 2015 5:44 am, edited 1 time in total.

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 04, 2015 8:57 pm
hdfreak offline
Posts: 19
Joined: Jan 01, 2015

Re: Variable Use in Simple Fields

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.

Posted on
Sun Jan 04, 2015 9:03 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Variable Use in Simple Fields

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

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 04, 2015 11:01 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Variable Use in Simple Fields

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... :)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests