Indigo variables example

Posted on
Fri Jan 15, 2016 9:24 am
skoeppen offline
Posts: 47
Joined: Oct 23, 2012
Location: Taneytown, Maryland

Indigo variables example

I'm just learning Python scripting in Indigo. The code below was run in the scripting shell and is essentially the first example given in the Indigo scripting tutorial on variables. Why doesn't newVar.value show the updated values?


>>> newVar = indigo.variable.create("fooMonster", "5")
>>> newVar.value
u'5'
>>> indigo.variable.updateValue(newVar, "10")
>>> newVar.value
u'5'
>>> indigo.variable.updateValue(newVar, "20")
>>> newVar.value
u'5'

Steve Koeppen
X10 user from the early 80's
Converted to Insteon 2011 - 2014
Started adding z-wave 2014
Happy :D Indigo owner since v1 in 2005

Posted on
Fri Jan 15, 2016 9:47 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Indigo variables example

You need to do a refresh after the update to refresh the local copy as per the Variable Class documentation

Add this line after you do each update value:
Code: Select all
newVar.refreshFromServer()  # refresh needed to update local's .value
Hope this helps :)

Posted on
Fri Jan 15, 2016 10:22 am
skoeppen offline
Posts: 47
Joined: Oct 23, 2012
Location: Taneytown, Maryland

Re: Indigo variables example

Thanks Jon. That did it.

Steve Koeppen
X10 user from the early 80's
Converted to Insteon 2011 - 2014
Started adding z-wave 2014
Happy :D Indigo owner since v1 in 2005

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest