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.
Announcement
Collapse
No announcement yet.
HSBuddy Clients Current Longitude and Latitude
Collapse
X
-
Hi Will,
Can you share this Bing maps script?
thanks, Walter
Originally posted by will40 View PostI 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
-
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'>" & " " & BLocation, True) 'my HS3 devicestring
Catch ex As Exception : hs.writelog("LocationScript", "Error: " & ex.Message.ToString)
End Try
End Sub
Comment
-
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
-
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
Comment