Get indigo variable into email via python

Posted on
Sat Jan 02, 2016 7:21 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Get indigo variable into email via python

This may have been answered before but I cannot seem to find it in the forums.

I have created an indigo variable that is called daily_pool_water_fill

I would like to send an email with the value of daily_pool_water_fill via python script

the variable id for daily_pool_water_fill is 410242667

I create this script to send an email however I am getting an error. I do not have the proper syntax for the variable. Any help appreciated

This is the script and the error I receive

SCRIPT
poolfill = indigo.variable[410242667]
theSubject = "Pool Water Fill: is %s" % (poolfill)
theBody = "Login to see monthly chart"
indigo.server.sendEmailTo("xxxyyy@me.com", subject=theSubject, body=theBody)
return

ERROR

Jan 2, 2016, 8:16:53 AM
Script Error embedded script: 'VariableCmds' object does not support indexing
Script Error Exception Traceback (most recent call shown last):

embedded script, line 1, at top level
TypeError: 'VariableCmds' object does not support indexing

Posted on
Sat Jan 02, 2016 7:34 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Get indigo variable into email via python

Try:
Code: Select all
poolfill = indigo.variables[410242667].value
Note the spelling of variables (S at the end) plus you want the value :)

Documentation available here: Variables

Posted on
Sat Jan 02, 2016 7:41 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Get indigo variable into email via python

thx it works great

Posted on
Sat Jan 02, 2016 7:45 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Get indigo variable into email via python

Or, if you don't want to do any scripting at all, use the BetterEmail plugin to send the email. Then you just need to use the variable substitution syntax (%%v: 410242667%%) to put the variable value in the email text.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest