Announcement

Collapse
No announcement yet.

Everything was fine

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

    Everything was fine

    I'm not sure when things went awry but I have an event that speaks when I enter a certain zipcode. Simple enough, except the event is not running and I'm not sure when it stopped working.

    The PHLocation map shows my travels so Backitude is sending the proper info and nothing else has changed.

    The only possible thing I see wrong is that my zipcode shows as a string, not a value and I have no way to enter the string "11510" as opposed to the value 11510. I'm not sure if this changed somewhere along the line or if something else is askew.
    Attached Files

    #2
    Originally posted by racerfern View Post
    I'm not sure when things went awry but I have an event that speaks when I enter a certain zipcode. Simple enough, except the event is not running and I'm not sure when it stopped working.

    The PHLocation map shows my travels so Backitude is sending the proper info and nothing else has changed.

    The only possible thing I see wrong is that my zipcode shows as a string, not a value and I have no way to enter the string "11510" as opposed to the value 11510. I'm not sure if this changed somewhere along the line or if something else is askew.
    The Postal Code has always been stored as a string, never a value. I don't know how your event could have ever worked. I used Easy Trigger to trigger on "The device's string changes and contains..." on my zipcode events.
    HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      I don't know how your event could have ever worked.
      Nor do I, I just remember my wife saying, "Google said you were almost home, how did you do that?". It worked for quite some time, now I don't know how or why.

      I'll try the easytrigger way. Thanks.

      Comment


        #4
        The reason that only the string is updated is that the Post Code in some countries (like here in the UK) is not purely a numerical value.

        The plug-in has a built in "Post Code Change" trigger which could be used to fire an event, however as Randy points out it is not possible with standard HS3 events to query the string value from an event.

        Another way to achieve what you want to do would be to have the "Post Code Change" trigger fire an event that runs a script.

        I don't know how the US postcode system works but something like this should work. The example assumes that the PHLocation Current Post Code has a device ref of 1234 and you want to check 3 Post Codes 11509, 11510 and 11511.

        If you only want to check a single Post Code, then the script can be simplified somewhat.

        Paul..

        Code:
        Sub Main(Optional ByVal Parms As String = "")
            Dim PostCodeDvRef As Integer = 1234
            Dim PostCodesToCheck() As String = {"11509", "11510", "11511"}
        
            Dim PostCodeCurrent As String = ""
            Dim MatchFound As Boolean = False
        
            If hs.DeviceExistsRef(PostCodeDvRef) Then
                PostCodeCurrent = hs.DeviceString(PostCodeDvRef)
                If Not PostCodeCurrent = "" Then
                    For i As Integer = 0 To Ubound(PostCodesToCheck)
                        If PostCodeCurrent.ToUpper = PostCodesToCheck(i).ToUpper Then
                            MatchFound = True
                            Exit For
                        End If
                    Next
                End If
            Else
                hs.WriteLog("Error", "Post Code DvRef " & PostCodeDvRef & " doesn't exist in HS")
            End If
        
            If MatchFound Then
                hs.speak("Dad should be home soon.", True, "Kitchen:*")
            End If
        
        End Sub

        Comment

        Working...
        X