Announcement

Collapse
No announcement yet.

HSBuddy Clients Current Longitude and Latitude

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

  • wallee
    replied
    Hi Will,

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

    best regards,

    Walter

    Leave a comment:


  • will40
    replied
    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 



    Leave a comment:


  • wallee
    replied
    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?

    Leave a comment:


  • will40
    replied
    will do

    Leave a comment:


  • jon00
    replied
    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.

    Leave a comment:


  • will40
    replied
    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.

    Leave a comment:


  • jon00
    replied
    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....

    Leave a comment:


  • will40
    replied
    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?

    Leave a comment:


  • wallee
    replied
    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.

    Leave a comment:


  • HansSchouten
    replied
    +1

    Leave a comment:


  • wallee
    replied
    +1

    Leave a comment:


  • Ken.238
    replied
    +1

    Leave a comment:


  • OmegaQuest
    started a topic HSBuddy Clients Current Longitude and Latitude

    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.
Working...
X