Hi Jon00
Your pop email checker has been running happily in the background but i noticed something strange recently. I have been tinkering so much with the trigger script that i forget all the changes i make, but basically the device strings that relate to this script seem to go "Unknown" all the time. When the script triggers for a call, it will update them, but shortly after it will make them unknown again.
I am a-bit stumped, is there anything simple in the below script that you could see would be the cause?
In previous versions i used to use TOOM, however i would end up triggering the script to many times, since multiple brigades would get the same call, and each would have the TOOM trigger in it, so i changed it to the number which represents the pager address. It does still trigger on that but as i was saying for some reason becomes unknown.
It would be nice for it to not reset, since it is good being able to look back at what the call was, especially if i am away from home.
Thanks for your help!
Your pop email checker has been running happily in the background but i noticed something strange recently. I have been tinkering so much with the trigger script that i forget all the changes i make, but basically the device strings that relate to this script seem to go "Unknown" all the time. When the script triggers for a call, it will update them, but shortly after it will make them unknown again.
I am a-bit stumped, is there anything simple in the below script that you could see would be the cause?
In previous versions i used to use TOOM, however i would end up triggering the script to many times, since multiple brigades would get the same call, and each would have the TOOM trigger in it, so i changed it to the number which represents the pager address. It does still trigger on that but as i was saying for some reason becomes unknown.
It would be nice for it to not reset, since it is good being able to look back at what the call was, especially if i am away from home.
Thanks for your help!
Code:
Sub Main(Data) Dim MailTotalMessages Dim MailboxNumber Dim MessageNumber Dim MailTo Dim MailToDisplay Dim MailFrom Dim MailFromDisplay Dim MailDate Dim MailSubject Dim MailSize Dim Filecount Dim Filenames Dim MailText Dim MailTextHTML Data = Replace (Data,"|$|",",",1,-1,1) Data=Replace (Data,"|[|","(",1,-1,1) Data=Replace (Data,"|]|",")",1,-1,1) MailTotalMessages = hs.stringItem(Data,1,"|#|") MailboxNumber = hs.stringItem(Data,2,"|#|") MessageNumber = hs.stringItem(Data,3,"|#|") MailTo = hs.stringItem(Data,4,"|#|") MailToDisplay = hs.stringItem(Data,5,"|#|") MailFrom = hs.stringItem(Data,6,"|#|") MailFromDisplay = hs.stringItem(Data,7,"|#|") MailDate = hs.stringItem(Data,8,"|#|") MailSubject = hs.stringItem(Data,9,"|#|") MailSize = hs.stringItem(Data,10,"|#|") Filecount = hs.stringItem(Data,11,"|#|") Filenames = hs.stringItem(Data,12,"|#|") MailText=hs.stringItem(Data,13,"|#|") MailTextHTML=hs.stringItem(Data,14,"|#|") '************************** Do not edit above this line ************************** 'Each time new email arrives, this script will be triggered and provide full details of the 'email message using the above variables 'In this example, if an email is received from the homeseer message board then the virtual 'device s7 will display the message If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"057900",1) > 0 then hs.SetDeviceString "E10", MailText, True hs.triggerevent "LOCAL Fire Call" end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"BEUP",1) > 0 then hs.SetDeviceString "E9", MailText, True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"BEUP",1) > 0 and Instr(1,MailText,"G&SC1",1) > 0 then hs.SetDeviceString "E9", MailText, True hs.triggerevent "BEUP Fire Call" end if If Instr(1,MailText,"ALERT",1) > 0 and Instr(1,MailText,"0566552",1) > 0 then hs.SetDeviceString "E2", MailText, True If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"G&SC1",1) > 0 then hs.SetDeviceString "E4","Grass and Scrub Fire", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"G&SC3",1) > 0 then hs.SetDeviceString "E4","Grass and Scrub Fire", True hs.SetDeviceString "E5", "Code 3", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"NOSTC1",1) > 0 then hs.SetDeviceString "E4","Non Structure Fire", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"NOSTC3",1) > 0 then hs.SetDeviceString "E4","Non Structure Fire", True hs.SetDeviceString "E5", "Code 3", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"ALARC1",1) > 0 then hs.SetDeviceString "E4","Alarm Circuit Activation", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"ALARC3",1) > 0 then hs.SetDeviceString "E4","Alarm Circuit Activation", True hs.SetDeviceString "E5", "Code 3", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"RESCC1",1) > 0 then hs.SetDeviceString "E4","Rescue", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"RESCC3",1) > 0 then hs.SetDeviceString "E4","Rescue", True hs.SetDeviceString "E5", "Code 3", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"STRUC1",1) > 0 then hs.SetDeviceString "E4","Structure Fire", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"STRUC3",1) > 0 then hs.SetDeviceString "E4","Structure Fire", True hs.SetDeviceString "E5", "Code 3", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"INCIC1",1) > 0 then hs.SetDeviceString "E4","Incident", True hs.SetDeviceString "E5", "Code 1", True end if If Instr(1,MailText,"Alert",1) > 0 and Instr(1,MailText,"0566552",1) > 0 and Instr(1,MailText,"INCIC3",1) > 0 then hs.SetDeviceString "E4","Incident", True hs.SetDeviceString "E5", "Code 3", True end if hs.Plugin("TwittSeer").Tweet("@travishale FIRE CALL, Respond to: DS(E4), DS(E5)") hs.triggerevent "Update Melways Fire Call" hs.triggerevent "Update Fire Map" hs.triggerevent "CFA-Home" hs.writelog "FireCall","There was a fire call" end if ' This will write all available details (apart from the email body) to the Homeseer log: 'hs.writelog "Jon00_Email","TriggerScript Test - Total Messages in mailbox: " & MailTotalMessages 'hs.writelog "Jon00_Email","TriggerScript Test - Mailbox number: " & MailBoxNumber 'hs.writelog "Jon00_Email","TriggerScript Test - Message number: " & MessageNumber 'hs.writelog "Jon00_Email","TriggerScript Test - Email address to: " & MailTo 'hs.writelog "Jon00_Email","TriggerScript Test - Email name to: " & MailToDisplay 'hs.writelog "Jon00_Email","TriggerScript Test - Email address from: " & MailFrom 'hs.writelog "Jon00_Email","TriggerScript Test - Email name from: " & MailFromDisplay 'hs.writelog "Jon00_Email","TriggerScript Test - Email date: " & MailDate 'hs.writelog "Jon00_Email","TriggerScript Test - Email subject: " & MailSubject 'hs.writelog "Jon00_Email","TriggerScript Test - Email size: " & MailSize 'hs.writelog "Jon00_Email","TriggerScript Test - Email filecount: " & Filecount 'hs.writelog "Jon00_Email","TriggerScript Test - Email filenames: " & Filenames 'hs.writelog "Jon00_Email","TriggerScript Test - Email body: " & MailText 'hs.writelog "Jon00_Email","TriggerScript Test - Email body HTML: " & MailTextHTML If Instr(1,MailText,"QD1200 baud heartbeat",1) > 0 then hs.SetDeviceString "a99", "Fire pager heartbeat received at " & now(), True hs.SetDeviceValue "a99", 1 end if end sub
Comment