Announcement

Collapse
No announcement yet.

pop email checking + unknown device string.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    pop email checking + unknown device string.

    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!

    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
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

    #2
    As I have no reference email to work to, I cannot really assist at the moment.

    Change the line:

    'hs.writelog "Jon00_Email","TriggerScript Test - Email body: " & MailText

    To

    hs.writelog "Jon00_Email","TriggerScript Test - Email body: " & MailText

    When there is an email , post or email me the Email body from the HS log.
    Jon

    Comment


      #3
      This was one of the emails:

      4/22/2012 10:05:56 PM Jon00_Email TriggerScript Test - Email body: 1151412 22:05:44 22-04-12 QD1200 baud heartbeat - System-Check
      What it does is sends lots of emails internally, and I have the homeseer system work out which one is the most appropriate, so it should ignore and delete most emails, except a few which would trigger the script and a few events etc.

      Below is an example of an email that would not trigger the event but would be similar:

      4/22/2012 10:08:25 PM Jon00_Email TriggerScript Test - Email body: 0569192 22:08:10 22-04-12 @@ALERT F120413706 SALE1 STRUC1 CAR FIRE IN GARAGE OPPOSITE 92 FITZROY ST SALE /YORK ST //MARLEY ST SVSE 8578 D7 (061829) CMAFF CSALE [SALE]@[ - Sale
      If the 0569192 was replaced with 0566552 it would trigger, so for example the above as written below should trigger the script(s):

      4/22/2012 10:08:25 PM Jon00_Email TriggerScript Test - Email body: 0566552 22:08:10 22-04-12 @@ALERT F120413706 SALE1 STRUC1 CAR FIRE IN GARAGE OPPOSITE 92 FITZROY ST SALE /YORK ST //MARLEY ST SVSE 8578 D7 (061829) CMAFF CSALE [SALE]@[ - Sale
      HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

      Facebook | Twitter | Flickr | Google+ | Website | YouTube

      Comment


        #4
        So which devicestrings are going to unknown?
        Jon

        Comment


          #5
          They actually all do within the CFA group i have them in, but no other devices go blank.

          For example the following will be blank

          E4
          E5
          E2


          Unknown
          Country Fire Authority Toomuc Call Type E4 Status Only Never Set Unknown
          Country Fire Authority Toomuc Pager Message E2 Status Only Never Set Unknown
          Country Fire Authority Toomuc Call Code E5
          HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

          Facebook | Twitter | Flickr | Google+ | Website | YouTube

          Comment


            #6
            I'm not sure but I do not think it is the script. For example, every instance of devicestring E5 is set with some form of text i.e. "code 3". If this is being reset, then something else must be changing it.
            Jon

            Comment

            Working...
            X