| Author |
Message |
|
WKU
Joined: Aug 19, 2008 Posts: 3
|
 Best way to pass variables to email messages
what is the best way to insert information from a device into an email. I would like to be able to ask indigo for a status ands have it return an email containing the temperature 9and in the future other information such as a picture)
|
| Mon Dec 22, 2008 11:28 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
 Re: Best way to pass variables to email messages
WKU wrote:what is the best way to insert information from a device into an email. I would like to be able to ask indigo for a status ands have it return an email containing the temperature
This will require a litttle scripting (and therefore Indigo Pro if using 4.0 or later), but it isn't too bad: create an action of type "Execute AppleScript", and use/modify the following code:
- Code: Select all
set newline to ASCII character 10 -- I always do this because I don't like actual newlines in strings set emailAddress to "null@null.void" -- replace with your email address set emailSubject to "Indigo Summary" -- replace the following lines with the appropriate variable names or device names for your database set emailBody to "Value of variable iTunes_CurrentTrack is " & value of variable "iTunes_CurrentTrack" & newline set emailBody to emailBody & "Brightness of light Office Lamp is " & brightness of device "Office Lamp" & newline set emailBody to emailBody & "HVAC mode is " & hvac mode of device "Office Thermostat" & newline set emailBody to emailBody & "HVAC Temperature is " & temperatures of device "Office Thermostat" send email to emailAddress with subject emailSubject with body emailBody
And you'll get an email whose body looks like this: - Code: Select all
Value of variable iTunes_CurrentTrack is Mr. 3 Brightness of light Office Lamp is 0 HVAC mode is heatCoolOn HVAC Temperature is 72.0
_________________ Jay (Indigo Support)
|
| Tue Dec 23, 2008 5:09 am |
|
 |
|
WKU
Joined: Aug 19, 2008 Posts: 3
|
 Is there a way to get the ambient room temperature sent
Is there a variable that will send you the ambient room temperature? I would like to have the thermostat's report of the room temperature sent back to me in the email.
|
| Tue Dec 23, 2008 8:06 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
 Re: Is there a way to get the ambient room temperature sent
WKU wrote:Is there a variable that will send you the ambient room temperature? I would like to have the thermostat's report of the room temperature sent back to me in the email.
If you're using the Venstar, then the script above will. The last line, which contains 'temperatures of device "Office Thermostat"' will do that (assuming you replace "Office Thermostat" with the name of your thermostat...  )
_________________ Jay (Indigo Support)
|
| Tue Dec 23, 2008 9:56 am |
|
 |
|
WKU
Joined: Aug 19, 2008 Posts: 3
|
 Thanks.
Ive got a lot to learn
|
| Tue Dec 23, 2008 3:00 pm |
|
 |
|
casagold
Joined: Jul 18, 2011 Posts: 8
|
 Re: Best way to pass variables to email messages
I know this thread is old, but is there a way send the same info via the Growl plugin rather than email? Can the HVAC Temperature be included in the Growl message if it is not in the Variable List? Basically, I want to get a Growl message if my Venstar has a Temerature over 80 degrees.
|
| Fri Aug 19, 2011 5:05 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
 Re: Best way to pass variables to email messages
Indigo 5 has a plugin for Growl that will allow you to pass variable values in a Growl notification.
_________________ Jay (Indigo Support)
|
| Fri Aug 19, 2011 8:39 am |
|
 |
|
casagold
Joined: Jul 18, 2011 Posts: 8
|
 Re: Best way to pass variables to email messages
Thanks Jay.
I guess I am not sure how to pass the temperature of the thermostat into a variable so I can include that info in the Growl Message. Can you point me in the right direction?
|
| Fri Aug 19, 2011 9:56 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
 Re: Best way to pass variables to email messages
That would take a two-step process:
1) Create a trigger such that when the temperature1 of your thermostat changes the action would be an "Insert Device State into Variable", and you should insert your thermostat's "temperatureInputsAll" into a variable (be sure to use "temperatureInputsAll" - there's a bug in the current Action Collection if you try to use "temperatureInputs1" which I'll fix in the next beta release). So, every time the temperature of that thermostat changes it updates the variable. 2) Then create your Growl action with the variable substitution
At some point in the future we may offer device state substitution like we do variable substitution, but it's a much trickier proposition since you also have to specify a state (and internal state names aren't really exposed to users). But the above method works great.
_________________ Jay (Indigo Support)
|
| Fri Aug 19, 2011 10:24 am |
|
|