- Code: Select all
tell application "IndigoServer"
try
-- set up log file name
set fileName to "TempData.txt"
set filePath to path to documents folder as string
-- set filePath to filePath & "House:"
set filePath to filePath & fileName
-- open log file
set fileRef to open for access filePath with write permission
-- write the time to the log file
write ((month of (current date) as integer) as string) & "/" to fileRef starting at eof
write ((day of (current date) as integer) as string) & "/" to fileRef starting at eof
write ((year of (current date) as integer) as string) & tab to fileRef starting at eof
write ((time of (current date)) / 86400 as string) & tab to fileRef starting at eof
--write the boiler status
if value of variable "boiler_laston_time" as integer is greater than 0 then
write "on" to fileRef starting at eof
else
write "off" to fileRef starting at eof
end if
-- include outdoors temperature
set temp to value of variable "Temperature_Front_Porch" as real
write tab & (temp as string) to fileRef starting at eof
-- include basement temperature
set temp to value of variable "Temperature_Basement" as real
write tab & (temp as string) to fileRef starting at eof
-- include attic temperature
set temp to value of variable "Temperature_Attic" as real
write tab & (temp as string) to fileRef starting at eof
-- include dining-room temperature
set temp to value of variable "Temperature_Dining" as real
write tab & (temp as string) to fileRef starting at eof
-- include dining-room temperature change
set degPerHour to value of variable "Temperature_Dining_rate" as real
write tab & (degPerHour as string) to fileRef starting at eof
-- include rear-bedroom temperature
set temp to value of variable "Temperature_Ellies" as real
write tab & (temp as string) to fileRef starting at eof
-- include rear-bedroom temperature change
set degPerHour to value of variable "Temperature_Ellies_rate" as real
write tab & (degPerHour as string) to fileRef starting at eof
-- Finish logging and close the file
write return to fileRef starting at eof
on error err
log "temperature monitor error: " & err & return
end try
close access fileRef
end tell