Jump to content
C4 Forums | Control4

Changing subject of email notification


EagleMoon

Recommended Posts

I want to temporarily monitor the temperature changes in the house so I thought I'd just have it email me each time the temperature changes. I have an email template set up that I know works but it was for an alert on low temp for winter.

It appears that I can use the same template and just change the subject line or text in the programming, like (roughly):

When temperature changes

if temperature = 80

send email with subject of "Temperature is 80 degrees" <-- here i just modified what the template said before dragging into the script

Does that really work, though? If so, why would I ever need more than one email template if I can change address, subject and body in the programming when I use email notification?

If it works, then I would just add other sections for 78, 79, 81, 82, 83, 84

I really wish C4 just kept historical data and had graphing capability for the temperature sensors.

Link to comment
Share on other sites


And the answer is "yes, you can change the subject and body of the email to something other than what the template has before dragging it into the script". But if you change a field, be sure to press Enter or click in a different field before dragging. If you just change the field without that, your changes are not saved in the version that's associated with the script.

I had apparently forgotten to do that so when the temperature went to 78, the email I received showed the correct subject but the body was the original text from the template. Then I realized the easy way to test it was to set up a script based on a change to the set point of the thermometer. Then I just click the set point up or down to generate the event and email.

Link to comment
Share on other sites

Do you realize you can insert a temperature variable into an email on 1.8 and later?

Just curious...I haven't put too much thought in to what you're doing, but it seems like that may be beneficial and I didn't know if you were aware.

Link to comment
Share on other sites

Gee.... I was not consciously aware of that, but I see it now. And now that you mention it, I think I remember a thread about it a couple months ago, but I didn't pay any attention to that thread at the time.

So instead of a whole bunch of "If Temperature is xx, then email ...." and changing the email manually for each one, I can just send an email on a change. Only small downside is I have to look at the email body to see the temperature not just the subject line.

I think I'll have it do both for a day or so and see which I like. Of course it's a temporary thing anyway. I'm just curious how warm it gets in August when it's all closed up. I think I saw it at 83 or 84 in late July -- of course that's about the overnight low down here in Texas. Sure am looking forward to getting back up there next week!!!

Hmmmm, if I sent an email on every temp change using that varialbe, I bet I could write an Applescript to parse those emails, extract the temperature and the event time, then build my own graph of interior temperatures from every thermostat location. Ah, maybe next year when I'm not working.

Link to comment
Share on other sites

If your ultimate goal is graphing those temperatures, why don't you just send them via an HTTP request to a webserver, which can log them to a database, where you can retrieve them to graph?

You can actually use any IP Camera driver to do HTTP GET requests, with variables as parameters.

RyanE

Link to comment
Share on other sites

If your ultimate goal is graphing those temperatures, why don't you just send them via an HTTP request to a webserver, which can log them to a database, where you can retrieve them to graph?

You can actually use any IP Camera driver to do HTTP GET requests, with variables as parameters.

RyanE

Eh? :| That sounds like it would keep me busy and out of trouble for awhile. That certainly sounds like the "right" way to go about it but I don't think I know enough to do that.....neither on the C4 side nor the server side. I suppose I can figure it out, but might there be examples available somewhere? I have no idea where to even look.

Link to comment
Share on other sites

You can actually use any IP Camera driver to do HTTP GET requests, with variables as parameters.

Well, that wasn't so hard after all. Figuring out the sever side of that was pretty easy and using the Timeplot routine seems simple enough though more involved than simply coding a server to save the submitted data.

Next: Does the camera driver allow a user to customize the format and variable names in the URL it submits or do I have to code the server to something specific? Or, inn other words, is this another "dealer-only" deal?

To clarify, I mean can I specify the complete URL the camera driver uses, including subdirectories to the processing script and the GET/POST variables it requires as well as using C4 system variables as the values of those variables?

Where, or how, do I find the names of all the system variables that I could use? Edit: Disregard that last question, I see them in the announcements section and the format looks pretty straightforward for typing directly.

Link to comment
Share on other sites

Unfortunately, I've been looking at this again, and it looks like the camera driver will only accept *string* variables as parameters, so that kind of puts a crimp on sending temperature values, which are a *number* variable.

RyanE

Link to comment
Share on other sites

Unfortunately, I've been looking at this again, and it looks like the camera driver will only accept *string* variables as parameters, so that kind of puts a crimp on sending temperature values, which are a *number* variable.

RyanE

You would know loads more than I do about this but did you try it and know that it won't work? That means a "number" variable is literally a binary number value and the ${ } doesn't automatically do a type conversion to text if necessary?

I'll have to try it anyway when I'm back there this weekend.

Edit: I guess you could fake it with some really ugly code like a series of

When Living->LivingThermostat Temperature has changed

If Living->LivingThermostat->Temperature Equal to 60

Variables->My_variable = 60

stop

If Living->LivingThermostat->Temperature Equal to 59

Variables->My_variable = 59

stop

And so on, where My_variable is defined as string and that's the variable sent in the HTTP_GET.

Nasty.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...