apostolakisl Posted August 21, 2015 Posted August 21, 2015 1) Variable values can be displayed in emails. It is all in the configurations:emails/notifications:customizations tab 2) yes, it will show whatever the current value of the variable is. Presumably you would do something in your email like "Today set a new record for highest temp ever. It was $maxtemp F at $maxtempstamp" The date would show as 201508211553 for example as I wrote it. You could keep it all as separate variables and have it all written out nice and grammatically correct if that bothered you, but it would mean a bunch of extra of extra variables. Your choice. You would add the "send notification" line to the end of the above program. Then you would only get an email whenever the record was broken.
builderb Posted August 21, 2015 Posted August 21, 2015 So before I switched to the database, I used a program to test whether the exterior temp variable on the ISY was greater than the record high variable. If it was, that became the new record high current and init to value, and a notification was sent stating "A new record high temperature of ${var.2.XX} has been set at ${sys.time} on ${sys.date}.". The "init to" made sure the value survived a reboot, and the notification captured the event time. Now, this was only good for records that don't change often, because otherwise you're getting notifications all the time as the day gets warmer. But for a "hey, this value just went beyond anything it's ever recorded before at this time" notification, it's great. The notification is stamped with the time as it is sent, so if you need to know when it happened, you just need to find the notification. When I started plotting out how to get regular updates on the day's highs and lows that didn't come at inopportune times, or too often or rarely, I chickened out of doing it on the ISY, and I went for the Pi instead. I could see the solution would be something like what is posted above, but that I'd need to tweak it to my needs. I figured if I was going to spend a bunch of time coming up with a solution that worked for me, I'd rather it be web-based so I can access it however and wherever I want. And I knew I was going to want to do more with the sensor data I was collecting than just looking at it moment by moment.
larryllix Posted August 21, 2015 Posted August 21, 2015 (edited) 1) Variable values can be displayed in emails. It is all in the configurations:emails/notifications:customizations tab 2) yes, it will show whatever the current value of the variable is. Presumably you would do something in your email like "Today set a new record for highest temp ever. It was $maxtemp F at $maxtempstamp" The date would show as 201508211553 for example as I wrote it. You could keep it all as separate variables and have it all written out nice and grammatically correct if that bothered you, but it would mean a bunch of extra of extra variables. Your choice. You would add the "send notification" line to the end of the above program. Then you would only get an email whenever the record was broken. Ummmm.... I assume ISY uses signed 32 bit variable storage. Your value is over 10 digits and 2^31 = 2,147,483,648. The best ISY could hold would be 1,508,211,553 truncating the year century, with this example. If you multiply the year 2015 times 100,000,000 you will get an overflow condition and this will result in a negative number -363,462,912 Edited August 21, 2015 by larryllix
apostolakisl Posted August 22, 2015 Posted August 22, 2015 (edited) Ummmm.... I assume ISY uses signed 32 bit variable storage. Your value is over 10 digits and 2^31 = 2,147,483,648. The best ISY could hold would be 1,508,211,553 truncating the year century, with this example. If you multiply the year 2015 times 100,000,000 you will get an overflow condition and this will result in a negative number -363,462,912 Yeah, didn't count the digits. You would need to truncate the year to 2 digits. So today at 2:45 pm would be 1,508,221,445 Or you could just use separate variables for year, month, day, time instead of packing them into a single variable. $maxtempstampyear = [current year] $maxtetmpstampmonth = [current month] etc $maxtempstampyear init to $maxtempstampyear etc $maxtempstamp = [Year] (this option is available in 5.0) $maxtempstamp = $maxtempstamp - 2000 *****add this line $maxtempstamp = $maxtempstamp * 100000000 $maxtempstampworkingvariable = [month] Edited August 22, 2015 by apostolakisl
Recommended Posts