Announcement

Collapse
No announcement yet.

Btraced track & trace with possiblity to interface with Homeseer

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

    Btraced track & trace with possiblity to interface with Homeseer

    Hi All,
    Btraced Track and Trace for the iPhone is in the appstore and the Androidstore now.
    Nice thing about Btraced is that its intentially designed for use within home automation.
    the app can send an XML to your own server of choice.
    With the use of a script (asp/asp.net etc.) you can import this in HS.
    You can use it to see if you are coming closer to your home, switch devices and inform your wife :-)
    sample asp or php scripts available to receive the XML on your HS server, but HS functions will work also!
    Check the features on www.btraced.com and http://forum.btraced.com

    Android store:
    https://play.google.com/store/apps/d...id=com.btraced
    Appstore:
    https://itunes.apple.com/app/btraced/id498853172?mt=8


    Best Regards Bwired
    Last edited by bwired; August 8, 2013, 03:58 PM.

    #2
    Some more technical information about uploading Btraced Gps points to your own server you can find here:
    http://forum.btraced.nl/viewforum.ph...62e3c5fafa2c38

    Comment


      #3
      Originally posted by bwired View Post
      Some more technical information about uploading Btraced Gps points to your own server you can find here:
      http://forum.btraced.nl/viewforum.ph...62e3c5fafa2c38
      The Snelv Latitude script does this with Google Latitude. It is open sourced, so could be modified to support this. If parses an XML file already.
      HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

      Plug-Ins Enabled:
      Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
      weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

      Comment


        #4
        thanks for sharing!

        I looked at the Snelv Latitude script and I think it can be adjusted easy to receive the Btraced XML.
        The Btraced XML has a lot of information as well like:
        - Iphoneid (multiple persons tracking)
        - Speed, Angle, Altitude, Battery level, Traveled time and Distance for every uploaded GPS point

        You are also able to sent messages back from the server to the iPhone
        in case of Home Automation this can be fun. So if a GPS point is loaded to your server, you can check this and if necessary send a status or message back to the iphone, which will pop-up.

        Message format is like

        {
        "error":true,
        "id":900,
        "message":"The house heating is set to 20 degrees.",
        "showonce":true,
        "valid":true
        }

        Trips uploaded are validated from the server to the Btraced iphone app. So you never miss a point. also all trips are stored on the iPhone and can be uploaded any time later to any server you like. If you don't have a internet connecting or Cell phone signal is not there the not uploaded points are uploaded again so you wont miss any GPS point;

        {
        "id":0,
        "tripid":456,
        "points":[1,2,3,4,5,6,7,8,9],
        "valid":true
        }


        sample XML file:

        Code:
        <bwiredtravel>
        	<model>iPhone</model>
        	<devId>21622f43420a5590f327fcd78efb753c55189bff</devId>
        	<username>pk</username>
        	<password>testing</password>
        	<travel>
        		<id>1</id> 
        		<description>23-03-12 bike</description> Tripname
        		<length>2954.76</length>. Total trip in meters
        		<time>1014</time> Total trip time
        		<tpoints>129</tpoints> Total trip points
        		<uplpoints>100</uplpoints> 
        		<point>
        			<id>104</id>
        			<date>1332524797.424494</date> Epoch date time format
        			<lat>+51.724043</lat>
        			<lon>+5.300559</lon>
        			<speed>3.911873</speed> Speed * 3.6 = KM
        			<course>72.584372</course> Angle
        			<haccu>10.000000</haccu> Accuracy
        			<bat>0.40</bat> Iphone battery level 
        			<vaccu>9.000000</vaccu> Accuracy
        			<altitude>1.645592</altitude>
        			<continous>0</continous> 0 = continues trip, 1 = trip stopped and started again
        			<tdist>2559.39</tdist> Trip distance total at this point
        			<rdist>97.17</rdist> Distance from point to point
        			<ttime>811</ttime> Trip time total at this point
        		</point>
        		<point>
        			<id>105</id>
        			<date>1332524800.426888</date>
        			<lat>+51.724118</lat>
        			<lon>+5.300701</lon>
        			<speed>3.941704</speed>
        			<course>41.977433</course>
        			<haccu>10.000000</haccu>
        			<bat>0.40</bat>
        			<vaccu>9.373876</vaccu>
        			<altitude>2.436264</altitude>
        			<continous>1</continous>
        			<tdist>2572.19</tdist>
        			<rdist>12.80</rdist>
        			<ttime>814</ttime>
        		</point>
        	</travel>
        </bwiredtravel>
        and here sample Classic ASP code to store the XML in a Mysql Database
        Code:
        <%Dim my_conn, strSQL, rs, xmlDoc
        Dim points, uplpoints, totpoints, Speed, Angle, travelname, travelid, traveltime, travellenght, siphoneid, username, password, remainingPoints, maxPointsPerTrip, maxTrips
        
        set xmlDoc=Server.CreateObject("Microsoft.XMLDOM") 
        xmlDoc.async="false" 
        xmlDoc.load(Request) 
        
        username = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/username").text
        password = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/password").text
        siphoneid = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/devId").text
        travelname = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/description").text
        
        Set my_conn = createobject("ADODB.Connection")
        my_conn.open = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=xxx;UID=xxx;PWD=xxx;OPTION=35;"
        Set rs = CreateObject("ADODB.Recordset")
        rs.CursorLocation = 3
        
        uplpoints = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/uplpoints").text
        totpoints = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/tpoints").text
        travelid = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/id").text
        traveltime = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/time").text
        travellenght = xmlDoc.documentElement.selectSingleNode("//bwiredtravel/travel/length").text
        
        If isnumeric(travellenght) then
        	travellenght = travellenght / 1000
        else
        	travellenght = 0
        End if
        
        strSQL = "Select * from gps LIMIT 1" 
        rs.Open strSQL, my_conn, 1, 3
        
        On Error Resume Next
        my_conn.BeginTrans
        For Each Item In xmlDoc.documentElement.selectNodes("travel/point")
        	
        		rs.addnew
        		rs("travelname") = travelname 
        		rs("travelid") = travelid 
        		rs("travellenght") = formatnumber(travellenght,2)
        		rs("totpoints") = totpoints 
        		rs("uplpoints") = uplpoints 
        		rs("traveltime") = fix(traveltime / 60)
        		rs("pointdistance") = Item.selectSingleNode("rdist").Text
        		rs("pointdistancetotal") = Item.selectSingleNode("tdist").Text
        		rs("traveltimepoint") = fix(Item.selectSingleNode("ttime").Text / 60) 
        		rs("datum") = epoch2date(Item.selectSingleNode("date").Text)
        		rs("pointid") = Item.selectSingleNode("id").Text 
        		rs("lat") = Item.selectSingleNode("lat").Text 
        		rs("slong") = Item.selectSingleNode("lon").Text 
        	
        		Speed = Item.selectSingleNode("speed").Text
        		If isnumeric(Speed) then
        			If Speed > 0 Then
        				Speed = (Speed * 3.6) 
        			Else
        				Speed = 0
        			End if
        		Else
        			Speed = 0
        		End if
        		rs("speed") = formatnumber(Speed,2)
        		
        		Angle = Item.selectSingleNode("course").Text
        		if left(Angle, 1) = "-" then
        			Angle = "0"
        		End If
        		rs("angle") = formatnumber(Angle,1)
        	
        		If isnumeric(Item.selectSingleNode("bat").Text) then
        			rs("Phone_BattStat") = Round((CSng(Item.selectSingleNode("bat").Text) * 100))
        		else
        			rs("Phone_BattStat") = 0
        		end If
        	
        		rs("altitude") = Item.selectSingleNode("altitude").Text
        		rs("haccu") = Item.selectSingleNode("haccu").Text
        		rs("vaccu") = Item.selectSingleNode("vaccu").Text
        		rs("continous") = Item.selectSingleNode("continous").Text 
        		rs("Iphoneid") = siphoneid
        		rs("Username") = username
        		rs("Password") = password
        		rs("datumupload") = now()
        		
        		points = points + Item.selectSingleNode("id").Text + ","
        		rs.update
        Next
        	
        If Err.Number <> 0 Then
        	my_conn.RollBack
        	response.write "{"& chr(34) & "error" & chr(34) & ":true," & chr(34) & "id" & chr(34) & ":900,"  & chr(34) & "message" & chr(34) & ":" & chr(34) & err.number & chr(34) & "," & chr(34) & "showonce" & chr(34) & ":true," & chr(34) & "valid" & chr(34) & ":true}"
        Else
        	my_conn.CommitTrans
        	response.write "{"& chr(34) & "id" & chr(34) & ":0," & chr(34) & "tripid" & chr(34) & ":" & travelid & "," & chr(34) & "points" & chr(34) & ":[" & points & "]," & chr(34) & "valid" & chr(34) & ":true}"
        End if
        
        rs.close
        my_conn.close
        set my_conn = nothing
        set xmlDoc = nothing 
        
        function epoch2date(myEpoch)
        	epoch2date = DateAdd("s", myEpoch, "01/01/1970 00:00:00")
        end function
        MySQL Script for creating the Mysql Database table

        Code:
        CREATE TABLE gps(
          Id INT(11) NOT NULL AUTO_INCREMENT,
          Datum DATETIME DEFAULT NULL,
          Travelid VARCHAR(10) DEFAULT NULL,
          Travelname VARCHAR(50) DEFAULT NULL,
          Travellenght VARCHAR(20) DEFAULT NULL,
          Traveltime VARCHAR(20) DEFAULT NULL,
          Traveltimepoint VARCHAR(20) DEFAULT NULL,
          Pointid VARCHAR(20) DEFAULT NULL,
          Pointdistance VARCHAR(20) DEFAULT NULL,
          Pointdistancetotal VARCHAR(20) DEFAULT NULL,
          Totpoints VARCHAR(15) DEFAULT NULL,
          Uplpoints VARCHAR(20) DEFAULT NULL,
          Continous CHAR(2) DEFAULT NULL,
          Lat VARCHAR(40) DEFAULT NULL,
          sLong VARCHAR(40) DEFAULT NULL,
          Speed VARCHAR(12) DEFAULT NULL,
          Angle VARCHAR(10) DEFAULT NULL,
          Altitude VARCHAR(15) DEFAULT NULL,
          Haccu VARCHAR(20) DEFAULT NULL,
          Vaccu VARCHAR(20) DEFAULT NULL,
          Phone_BattStat VARCHAR(10) DEFAULT NULL,
          Iphoneid VARCHAR(50) DEFAULT NULL,
          Username VARCHAR(50) DEFAULT NULL,
          Password` VARCHAR(50) DEFAULT NULL,
          Datumupload DATETIME DEFAULT NULL,
          PRIMARY KEY (Id),
        )
        ENGINE = MYISAM
        AUTO_INCREMENT = 0
        AVG_ROW_LENGTH = 207
        CHARACTER SET latin1
        COLLATE latin1_swedish_ci;

        Comment


          #5
          Has anyone modified the SnevlLatitude script to work with the BtraceD app?

          Comment


            #6
            Originally posted by DJF3 View Post
            Has anyone modified the SnevlLatitude script to work with the BtraceD app?
            SnevlLatitude works perfectly with this app if you uploading the data to Google Latitude.
            sigpic
            A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

            Comment


              #7
              Hi Gogs,

              What server address has to be used to send the data to Google Latitude?

              Thanks,

              Herbus

              Comment


                #8
                Any way I can convince you to make an Android version?

                :-)

                --Dan
                Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                Comment


                  #9
                  Originally posted by drozwood90 View Post
                  Any way I can convince you to make an Android version?

                  :-)

                  --Dan
                  If you use Android, you can use SnevlLatitude. I am tracking 3 iPhones, an Android phone, an iPad, and a Blackberry.
                  HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

                  Plug-Ins Enabled:
                  Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
                  weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

                  Comment


                    #10
                    Originally posted by herbus View Post
                    Hi Gogs,

                    What server address has to be used to send the data to Google Latitude?

                    Thanks,

                    Herbus
                    Not sure what you mean by send data to Google Latitude.

                    The apps are pre coded you just enter your login details.
                    sigpic
                    A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

                    Comment


                      #11
                      Originally posted by drozwood90 View Post
                      Any way I can convince you to make an Android version?

                      :-)

                      --Dan
                      If you use Android, you can use SnevlLatitude. I am tracking 3 iPhones, an Android phone, an iPad, and a Blackberry.
                      HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

                      Plug-Ins Enabled:
                      Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
                      weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

                      Comment


                        #12
                        SnevlLatitude works perfectly with this app if you uploading the data to Google Latitude.
                        Hi Gogs,
                        I assumed that Btraced can be used to upload the GPS data to Google Latitude and use SnevlLatitude to connect it to Homeseer.
                        If I start the settings in the Btraced app it's possible to upload the data to Btraced.com and to a customized server. Thougt that this was the place to enter the Google Latitude address.
                        Can't find any pre coded settings for Google Latitude.

                        Thanks,

                        Herbus

                        Comment


                          #13
                          All,

                          I'm very sorry, but I never even noticed this thread. It wasn't until recently that someone brought up the BTraced app on the Snevl Latitude thread that I even knew to look at it.

                          I'm now on the case, and am working to modify Snevl Latitude to support BTraced. For now, the goal is that allow you to simultaneously use either or both Latitude and/or BTraced to gather tracks. Pieter and Santiago are graciously answering my stupid questions (until they get tired of me), and this doesn't seem like it will take too long.

                          Initially, I'm not doing anything with the extra stuff that BTraced provides that is not available from Latitude. BTraced provides stuff like altitude, trip name, continuous movement flags, etc. Could be interesting, but I want to conform to the current Latitude model first.

                          Steve

                          P.S. I'm going to let you upload BTraced location info directly form your phone to your HS server and Snevl Latitude, without going through the BTraced server.

                          Comment


                            #14
                            Hey Steve,

                            I may have an extra iPhone or two that I would be happy to loan you for a bit. Let me know if I can help. I am currently using your latitude script along with Jon00's Bluetooth plug-in to do some pretty fun stuff. Having a more accurate location awareness on my iPhone would be fantastic.

                            Chris

                            Comment


                              #15
                              Originally posted by dcdelong View Post
                              Hey Steve,

                              I may have an extra iPhone or two that I would be happy to loan you for a bit. Let me know if I can help. I am currently using your latitude script along with Jon00's Bluetooth plug-in to do some pretty fun stuff. Having a more accurate location awareness on my iPhone would be fantastic.

                              Chris
                              Thanks Chris. I'm hoping I don't need to borrow an iPhone, but that is very gracious. It is a little harder debugging this via email, sending stuff to users who do have iPhones to try, but honestly if I can get by the initial stuff of getting data from the phone into Homeseer, I'm pretty convinced the rest will be easy (or at least not related to BTraced!).

                              Steve

                              Comment

                              Working...
                              X