www.homeseer.com    
 

Go Back   HomeSeer Message Board > Developer Support > Scripts & Plug-Ins:Development and Libraries > Script & Plug-In Library

Script & Plug-In Library If you have a script for HomeSeer that you would like to share, please post it here. This forum is for scripts only, and no replies are allowed here. You may discuss these scripts in the Scripts Discussion forum.

Reply
 
Thread Tools Display Modes
  #1  
Old June 26th, 2011, 04:26 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
[VB.NET/ASP.NET] Snevl Latitude

Attached is version 1.9 of Snevl Latitude, a script and web page package which builds on the absolutely brilliant idea from wpiman (his script posted here: http://board.homeseer.com/showthread.php?t=143249) to use Google Latitude to bring locations of your family and friends into Homeseer. Completely configured and maintained via the included web page. Features:
  • You can track as many people (Google latitude "badges") as you want, and designate several devices to display location information on each person. Some of the device strings are also hyperlinks to pop up a Google Map of the location.
  • You can have as many known "places" as you want (e.g. home, husbands work, the mall, etc.). Each place can have it's own maximum near distance, and any badges within that distance of that place will be designated 'near'.
  • You can pick which people and places you want to track the distance between, e.g. Steve from Home, again in device strings if you wish. The device will be turned ON when the person is near the place, and OFF when it is not near.
  • Can optionally create a static Google map image for each person, either showing the current location (a map pin on the map), or a track of the most recent N locations where N is 5,10,15, or 20 points. An example is shown below.
  • You can also create a static Google map showing the current locations of multiple badges, so you can show in one image the location of everyone in your family.
I'm using the .NET libraries locale handling of numbers and date/times, so I'm hoping this works for my friends in Europe as well.

Installation should be pretty simple (README included). If you are upgrading from a previous verison, do not over-write your database file in the data subdirectory. You should only need the script and web page.

Please post any comments, questions, bugs, or suggestions in the discussion thread: http://board.homeseer.com/showthread...233#post976233

Steve
Attached Images
 
Attached Files
File Type: zip Snevl_Latitude_v1.9.zip (226.4 KB, 377 views)

Last edited by stevea; January 22nd, 2012 at 04:44 PM. Reason: New version
Reply With Quote
  #2  
Old June 30th, 2011, 09:57 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.1 Posted

The ZIP in the first message of this thread had been replaced with v1.1 of Snevl Latitude. Changes from v1.0:
  • Added the option to have the distances expressed in km vs miles
  • Trap errors on reverse-geocoding
  • Fixed the range validator on the distances in the config page so that they are culture-agnostic, so should work in Europe
  • Fixed the database pruning / purging so that it should be culture-agnostic, and so should work in Europe
  • Trim the street address to < 50 characters, as the database logging is currently limited to 50 characters
  • Added more debug, including saving of the XML files for Latitude (in ATOM Format) and reverse-geocoding (in KML format) when debug is turned on.
As per usual, post any comments or issues in the discussion thread (http://board.homeseer.com/showthread...233#post976233) rather than here.

Steve
Reply With Quote
  #3  
Old July 2nd, 2011, 11:15 AM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.2 Posted

The ZIP attached to the first message of this thread has been replaced with v1.2. I think I've addressed most of the issues, and added a couple of features:
  • The culture differences in decimal points is finally fixed (thanks Moskus for beta testing).
  • Fixed the last-update time, so it should now report a time in your local timezone. I'm not sure I got it right, so please let me know.
  • The reverse-geocoding (looking up the address, city, and zip) has been completely re-done, and should do a pretty good job of pulling out all the data if Google provides it.
  • In the process, the reverse-geocoding should no longer cause the script to abort if data isn't found for a field as expected.
  • Actually using the "maximum near" distance from the config to mark "near" in the track history (it was actually hard-coded in v1.1).
  • Added a "test" link button to the badge table in the web page. This was another great idea from wpiman. Once you put in a Google badge # (User ID), you can click this button to verify that Google Latitude recognizes it. If you get no updates for a new badge, you might want to use this button to see if the problem is on the Google end rather than the script.
  • The distance devices are now turned ON and OFF based on the distance. If the distance is no more than the "max near" distance in the config, the device is turned ON, otherwise it will be OFF. The status changes in this device can be used to trigger other events, such as occupancy.
Although I'm hopeful that I caught everything, I'm sure some bugs or new ideas will pop up. Post those thoughts or questions over in the discussion thread: http://board.homeseer.com/showthread...233#post976233

Thanks!

Steve

EDIT: I forgot to mention the fix for the observation times, so I added it to the list above.

Last edited by stevea; July 2nd, 2011 at 05:27 PM.
Reply With Quote
  #4  
Old July 4th, 2011, 11:21 AM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.3 Posted

The ZIP attached to the first message of this thread has been replaced with the new version 1.3 ZIP. Sorry to post a new version again so soon, but there are quite a few changes, mostly enhancements requested in the discussion thread:
  • Create the distance devices in the OFF state, and turn it off if it is found to be in an unknown state.
  • More tuning of the reverse-geocoding, to better extract address, city, and postal code info
  • Add a 'maximum near distance' for each place, so near can be be different for each. Use the previous field in the config editor as the default for new places.
  • Use culture-independent distance calculation for European users
  • Added optional 'near' device for each badge, to show what places are near that person.
  • Extended the database fields for Position and Address to 100 characters in the track history database, to avoid having to clip off these fields that can be long (previously limited to 50 characters).
  • Added auto-upgrade of the database, for longer Position and Address fields, new near device code on badges table, and new max near field on places.
If upgrading, you should only have to replace the ASPX web page and the VB script. Your old database file (in data\SnevlLatitude) should automatically be upgraded the first time the script runs.

Post any issues or questions in the discussion thread: http://board.homeseer.com/showthread.php?t=149362

Steve
Reply With Quote
  #5  
Old July 17th, 2011, 11:32 AM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.4 Posted

I just updated the ZIP above with v1.4. Changes:
  • Added lots more reverse-geocoding, made it pretty fault-tolerant, and put in debug to trace where it finds what. It should find good addresses in most cases now.
  • If for some reason we fail to get the ATOM Latitude data from Google, we don't check the distances for "near". This was causing an error in the log.
  • ZIP now includes a starter database with v2 schema. The schema changed in Snevl Latitude v1.3, and I had included an auto-update in v1.3 to upgrade the database to the v2 schema. However, I forgot to include the new version for fresh installs, which made it a little difficult.
  • Improved the database schema auto-upgrade to be more forgiving and fault-tolerant.
  • Improved handling of new observations to allow for large uncertainty radius. See the discussion thread for details. Basically, any new observation is compared to the last known location. If both locations are within the error radius of either one, we assume the badge didn't actually move. However, if the new observation is more accurate than the old one, we take it's location (lat/lon, city, address, postal code) as actual location of the badge. The track log will not show that it moved, but it should have a more accurate location. If the new location is less accurate, we basically ignore it, except to increment the number of observations at the last location.
  • Added lots more debug. If you turn debug on, the debug log will grow pretty fast, so be aware.
Again, if you are upgrading you should only install the web page (ASPX) and the script (VB). Be careful not to overwrite your existing database, else you will have to re-enter everything.

Post any comments or questions in the discussion thread.

Steve
Reply With Quote
  #6  
Old July 31st, 2011, 09:36 AM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.5 Posted

The ZIP attached to the first message of this thread has been replaced with v1.5. Changes in this version:
  • I hope I am finally pulling everything that is available from the Reverse Geocode KML. If the Street Address, City, or Postal Code is missing in your track, it wasn't reported by Google.
  • A new option lets you choose to reject / ignore Google Latitude observations that are very inaccurate, represented by a accuracy radius greater than some amount.
  • Use the "Position" from the Reverse Geocode if it is available. This is much more verbose position, and sometimes even includes things like the name of the place (e.g., airport, mall, etc.).
  • There is now two formats to choose from for the track history table. One is the same as previous versions, showing the Street Address, City, and Postal Code. The new option adds the "First Seen" column (the first report date/time), and replaces the other location info with the "Position".
  • There are also two formats to choose from for the display of the tracks on the Google Map. The previous format used color gradients to show the newest to oldest. The new second format uses the same color for all the map markers (green), but puts a numerical label on each marker.
If upgrading, only replace the ASPX an VB files. Post any comments in the discussion thread (http://board.homeseer.com/showthread.php?t=149362).

Steve
Reply With Quote
  #7  
Old August 27th, 2011, 12:47 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.6 posted

The first post in this thread has been updated with the ZIP for v1.6. Changes in v1.6 include:
  • The track history part of the web page now includes a third optional format for the history table (selected from the config section). This third option drops the Latitude and Longitude fields and adds a distance / speed field. The speed is computed based on the time difference betewen the "Last Seen" time for the previous point to "First Seen" time for the current location. This is my new favorite format.
  • Also in the track history table, the latitude, longitude, and position fields are now hyperlinks. Clicking on one will bring up a Google Map in a new window showing the location of that point, whereby you can zoom in, pan, change to satellite view, etc.
  • Many of the location device strings are also now hyperlinks to bring up a Google Map.
  • There are a number of options now to choose from for the color of the current location map pin and the track map pins.
  • The track history plot on the static Google Map can now be 5,10,15, or 20 points long (instead of just 10 in previous versions).
If you are upgrading, only copy over the ASPX web page and the VB script.

As always, post any issues or suggestions over in the discussion thread: http://board.homeseer.com/showthread...233#post976233

Steve
Reply With Quote
  #8  
Old September 11th, 2011, 12:32 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.7 posted

The ZIP in the first post of this thread has been replaced with the one for v1.7. Not many changes in this version, but had to get something out to fix the bug that codemonkey reported in the discussion thread. Changes in v1.7:
  • Correctly saving the map width selection from the config page to the INI file. In previous version it wasn't being saved, and so defaulted to 400 pixels width.
  • Don't update devices if fail to get latitude data.
  • Broke out as a separate option the saving of the XML data (Latitude and Reverse Geocoding) for debug. This allows for the logging of debug information without filling you Logs directory with XML files.
  • Added an optional "tweak" to the algorithm that turns distance devices ON (when the badge is near the place) and OFF when the badge moves away from the place. The tweak is a little complicated, but hopefully the config page explains it sufficiently.
Only copy over the ASPX web page and the VB script if you are upgrading from a previous version.

Post any comments or suggestions in the discussion thread: http://board.homeseer.com/showthread...233#post976233

Steve
Reply With Quote
  #9  
Old October 14th, 2011, 05:04 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.8 posted

The first message in this thread has been updated with the ZIP file for v1.8 of SnevlLatitude. The changes in v1.8 include:
  • There is a new option to define the map type for the static map display. The choices are roadmap (the only choice previous to v1.8), terrain, sattelite, or hybrid. The choice affects all of the maps created by SnevlLatitude.
  • For maps that are only displaying the current location rather than a track, there is now an option to define the default zoom level for the map.
  • A new tab on the main web page now allows you to create a multi-badge map to show the locations of multiple people in one display. It does not show tracks, but can show (for example) the location for all the members of your family on one map. You can also specify a device to store the image in the device string, suitable for use with HSTouch.
  • An option has been added to discard / ignore new observations if their location and time would imply an unreasonable speed of travel. You can turn this feature on or off, and you can specify the maximum allowed speed to accept (in kph or mph, consistent with your other settings).
  • The near "tweak" that was added in v1.7 had a bug which initialized two of the tweak settings from the INI backwards. This has been corrected in v1.8.
Post comments in the discussion thread: http://board.homeseer.com/showthread...233#post976233

Steve
Reply With Quote
  #10  
Old January 22nd, 2012, 02:21 PM
stevea's Avatar
stevea stevea is offline
OverSeer
 
Join Date: Jan 2001
Location: Centennial, Colorado, USA
Posts: 3,396
v1.9 Posted

The message at the top of this thread has been updated with the ZIP file for v1.9 of Snevl Latitude. The changes in this version are:
  • When adding new badges, the default new badge ID is automatically incremented each time to prevent accidentally having two badges with the same badge ID, which caused web page errors.
  • The "Last Updated" device is now turned ON and OFF depending on if Google is providing updated data.
  • After auto-purging old data from the track history database, the database file is compacted to free up the unused space.
  • An error in the "tweak" algorithm for computing NEAR status was corrected. The algorithm was counting repeated reports with the same "last updated" time as new observations.
As always, please post any issues, requests, or questions in the discussion thread: http://board.homeseer.com/showthread.php?t=149362

Steve
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:26 PM.


Copyright HomeSeer Technologies, LLC