Announcement

Collapse
No announcement yet.

HSBuddy Clients Current Longitude and Latitude

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

    HSBuddy Clients Current Longitude and Latitude

    Is there a way to log a HSBuddy Client Longitude and Latitude to a Virtual Devices? Everything is working fine with Geofencing, but I want to be able to create a Virtual Device and for each client and have their current Longitude and Latitude reported so that I can track and log current positions.

    #2
    +1

    Comment


      #3
      +1

      Comment


        #4
        +1

        Comment


          #5
          I managed to do this with the SDJ-health plug-in using the log monitor. HSBuddy is logging the lat/long in the HS log. I made a trigger on the incoming Logtext This is written to a global var within the log monitor plugin. Then I copy this data to a virtual device with an event.

          Comment


            #6
            I was able to duplicate wallee method and took it a step further and write the device strings with address, city, state using a Bing maps script. Is there any way to trigger an event from any change in the plug-in's Global Variable rather than scraping the HS log for HSB's GPS coords?

            Comment


              #7
              There is no native method to trigger on Global Variable change..

              You could poll a script to check its current value and compare against the previous value and if different, trigger an event....

              Jon

              Comment


                #8
                Thanks Jon. I am actually testing out your file watcher script now to see if any change in the DB file to use as a trigger.

                I will try your poll solution next.

                Comment


                  #9
                  That should work fine.

                  The file watcher instructions are slightly wrong. You need to use the three Homeseer 3 dlls (not the HS4 versions).

                  Edit: Instructions changed and 3 Homeseer dll's added to download zip.
                  Jon

                  Comment


                    #10
                    will do

                    Comment


                      #11
                      Hi Will,

                      Can you share this Bing maps script?

                      thanks, Walter

                      Originally posted by will40 View Post
                      I was able to duplicate wallee method and took it a step further and write the device strings with address, city, state using a Bing maps script. Is there any way to trigger an event from any change in the plug-in's Global Variable rather than scraping the HS log for HSB's GPS coords?

                      Comment


                        #12
                        Walter

                        See below. I originally got this from mrhappy and sparkman a few years back and revised it for my use to scrape the lat/lon HS device values and export the result to a HS device string. Its not the most elegant script and requires the Homeseer GPS devices to be devicevalues but it works for me. Good luck and if you need anything else let me know?

                        Will

                        https://msdn.microsoft.com/en-us/library/ff701710.aspx

                        PHP Code:
                        Sub Main(ByVal Parm As Object)

                        Dim APIKey As String "YourBingAPIKeyHere"
                        Dim location As String

                        Dim Latitude 
                        As String= (hs.DeviceValueEx(3682)) 'my HS3 Lat devicevalue
                        Dim Longitude As String= (hs.DeviceValueEx(3680)) '
                        my HS3 Lon devicevalue

                        location 
                        = (Latitude "," Longitude'current position

                        Try
                        Dim XMLData As New XmlDocument

                        Dim URLString As String = "http://dev.virtualearth.net/REST/v1/Locations/" & location & "?o=xml&key=" & APIKey

                        XMLData.Load(URLString)

                        Dim sNS As String = XMLData.DocumentElement.Attributes("xmlns").Value
                        Dim oNsMgr = New XmlNamespaceManager(XMLData.NameTable)
                        oNsMgr.AddNamespace("def", sNS)

                        Dim BLocation As String = XMLData.SelectSingleNode("//def:Name", oNsMgr).InnerText

                        '
                        hs.writelog("Address", (BLocation))

                        hs.SetDeviceString(3683"<img src='images\Bing\world.png' width='32'>" " " BLocationTrue'my HS3 devicestring

                        Catch ex As Exception : hs.writelog("LocationScript", "Error: " & ex.Message.ToString)
                        End Try

                        End Sub 



                        Comment


                          #13
                          Hi Will,

                          thank you for sharing the script! I will try this weekend.

                          best regards,

                          Walter

                          Comment


                            #14
                            avargaskun would you be open to integrating this functionality directly into the plugin? Would be great to have vDevices to show where the family is. thx

                            Comment


                              #15
                              I will look into this - hoping to work on geolocation improvements once I finish some work on dashboards.

                              Not sure if a viable workaround, but just want to make sure you're aware that you can view a map of current device locations from within the plugin configuration page. If you go to Plugins > HSBuddy > Geofences and then tap on the "Clients" tab.

                              Comment

                              Working...
                              X