<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Tom,</div><div><br></div>That is cellular utilisation. Migrated from the old ovms_utilisation table into the new historicaldata, so everything is stored the same.<div><br></div><div>Record types for *-OVM-Utilisation:</div><div><br></div><div><ul class="MailOutline"><li>0: car_rx</li><li>1: car_tx</li><li>2: app_rx</li><li>3: app_tx</li></ul></div><div><br></div><div>It is the daily bytes transmitted to/from the car and apps. Used to drive the Cellular Usage chart in the Apps. Doesn't include cellular or network overhead - just the data the server saw.</div><div><br></div><div>This historical data system is amazingly flexible. I'm working on adding an option for drive and charge logs to it. Michael B's already got Twizzy battery and gps logs - and the GPS log stuff will get moved over to work on any vehicle.</div><div><br></div><div>Regards, Mark.</div><div><br></div><div>P.S. The *-OVM-DebugCrash is also really cool. It was also contributed by Michael B and allows us to see what happened each time a car module firmware was started (including the cause of the start and the where in the code it was).</div><div><br><div><div>On 1 Mar, 2013, at 2:27 PM, Tom Saxton wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Very cool!<br><br>I see that the /api/historical/<VEHICLEID> returns a list of the types of<br>records available via the h_recordtype field.<br><br>I mostly understand the *-OVM-DebugCrash records, but how do we interpret<br>the *-OVM-Utilisation records?<br><br> Tom<br><br>on 2/28/13 10:02 PM, Mark Webb-Johnson wrote:<br><br><blockquote type="cite">I've implemented some more of this. Current status is that the following have<br></blockquote><blockquote type="cite">been implemented and are now live and working on tmc server:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/cookie Login and return a session<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">cookie<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/cookie Delete the session cookie and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">logout<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/vehicles Return a list of registered<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">vehicles<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/protocol/<VEHICLEID> Return raw protocol records (no vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">connection)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/status/<VEHICLEID> Return vehicle status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/tpms/<VEHICLEID> Return toms status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/location/<VEHICLEID> Return vehicle location<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/charge/<VEHICLEID> Return vehicle charge status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/historical/<VEHICLEID> Request historical data summary<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/historical/<VEHICLEID>/<DATATYPE> Request historical data records<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The following are still being worked on:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/vehicle/<VEHICLEID> Connect to, and return vehicle information<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/vehicle/<VEHICLEID> Disconnect from vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/charge/<VEHICLEID> Set vehicle charge status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/charge/<VEHICLEID> Abort a vehicle charge<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/lock/<VEHICLEID> Return vehicle lock status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/lock/<VEHICLEID> Lock a vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/lock/<VEHICLEID> Unlock a vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/valet/<VEHICLEID> Return valet status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/valet/<VEHICLEID> Enable valet mode<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/valet/<VEHICLEID> Disable valet mode<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/features/<VEHICLEID> Return vehicle features<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/feature/<VEHICLEID> Set a vehicle feature<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/parameters/<VEHICLEID> Return vehicle parameters<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/parameter/<VEHICLEID> Set a vehicle parameter<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/reset/<VEHICLEID> Reset the module in a particular vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/homelink/<VEHICLEID> Activate home link<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Feel free to have a play.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards, Mark.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">P.S. API is still being changed, so I don't suggest you write production code<br></blockquote><blockquote type="cite">to it yet (until it has been documented and is stable).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Begin forwarded message:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">From: Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Subject: [Ovmsdev] Fwd: HTTP API<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Date: 22 February, 2013 10:17:23 PM GMT+08:00<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">To: OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Reply-To: OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I've done some work on this, and tidied up the foundational servers. I've now<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">got a basic framework working in the non-blocking environment of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ovms_server.pl.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">You can try this yourself using <a href="http://tmc.openvehicles.com/api">http://tmc.openvehicles.com/api</a>. At the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">moment I've only enabled HTTP. I'll enable HTTPS (the server already supports<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">it - I just need to install the certificates) when we are ready for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">production.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The first thing you must do to use the api is authenticate to establish a<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">session and get a cookie (so you don't need to authenticate every time). This<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">is done with a http "GET /api/cookie" passing parameters 'username' and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">'password' as your <a href="http://www.openvehicles.com">www.openvehicles.com</a> username and password respectively.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">$ curl -v -X GET -c cookiejar<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://tmc.openvehicles.com:6868/api/cookie?username=USERNAME\&password=PASSW">http://tmc.openvehicles.com:6868/api/cookie?username=USERNAME\&password=PASSW</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ORD<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* About to connect() to <a href="http://tmc.openvehicles.com">tmc.openvehicles.com</a> port 6868 (#0)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Trying 64.111.70.40...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* connected<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Connected to <a href="http://tmc.openvehicles.com">tmc.openvehicles.com</a> (64.111.70.40) port 6868 (#0)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">GET /api/cookie?username=USERNAME&password=PASSWORD HTTP/1.1<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OpenSSL/0.9.8r zlib/1.2.5<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Host: tmc.openvehicles.com:6868<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Accept: */*<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* HTTP 1.0, assume close after body<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< HTTP/1.0 200 Authentication ok<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Connection: close<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Content-Length: 9<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Cache-Control: max-age=0<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Content-Type: text/plain<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Added cookie ovmsapisession="9ed66d0e-5768-414e-b06d-476f13be40ff" for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">domain <a href="http://tmc.openvehicles.com">tmc.openvehicles.com</a>, path /api/, expire 0<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Set-Cookie: ovmsapisession=9ed66d0e-5768-414e-b06d-476f13be40ff<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Date: Fri, 22 Feb 2013 12:43:56 GMT<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Expires: Fri, 22 Feb 2013 12:43:56 GMT<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Login ok<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Once logged in, all subsequent requests should pass the cookie<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(ovmsapisession). The session will expire after 3 minutes of no use, or you<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">can specifically terminate / logout the session by calling "DELETE<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">/api/cookie".<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">We could have other authentication mechanisms, but I'm really trying to move<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">to a simple username/password mechanism.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">To obtain a list of vehicles on your account, you can use the "GET<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">/api/vehicles" call:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">$ curl -v -X GET -b cookiejar <a href="http://tmc.openvehicles.com:6868/api/vehicles">http://tmc.openvehicles.com:6868/api/vehicles</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* About to connect() to <a href="http://tmc.openvehicles.com">tmc.openvehicles.com</a> port 6868 (#0)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Trying 64.111.70.40...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* connected<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Connected to <a href="http://tmc.openvehicles.com">tmc.openvehicles.com</a> (64.111.70.40) port 6868 (#0)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">GET /api/vehicles HTTP/1.1<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OpenSSL/0.9.8r zlib/1.2.5<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Host: tmc.openvehicles.com:6868<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Accept: */*<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Cookie: ovmsapisession=9ed66d0e-5768-414e-b06d-476f13be40ff<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* HTTP 1.0, assume close after body<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< HTTP/1.0 200 Logout ok<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Connection: close<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Content-Length: 280<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Cache-Control: max-age=0<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Content-Type: application/json<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Date: Fri, 22 Feb 2013 12:44:41 GMT<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< Expires: Fri, 22 Feb 2013 12:44:41 GMT<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">< <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">[<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {"id":"DEMO","v_apps_connected":0,"v_net_connected":1},<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {"id":"MARKSCAR","v_apps_connected":1,"v_net_connected":1},<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {"id":"QCCAR","v_apps_connected":0,"v_net_connected":0},<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {"id":"RALLYCAR","v_apps_connected":0,"v_net_connected":0},<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {"id":"TESTCAR","v_apps_connected":0,"v_net_connected":0}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">]<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(note that the above is re-formatted slightly, to make it clearer to read).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The return data is a json formatted array of hashes. Each record is one for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">one vehicle and shows you the vehicle id, as well as counts for the number of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">apps currently connected to that vehicle, and whether the vehicle is<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">connected to the net (server) or not.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">From the server point of view, we can treat an api session just like an app<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">session. From the vehicle point of view there will be no difference - once an<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">API connects to a vehicle, the server will send a "Z 1" message to tell the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">module it has a connection. If the session times out or is logged out, the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">server will inform the modules in the vehicles.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The above has all been implemented, and you can try it.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The following commands are what I am thinking about:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/protocol/<VEHICLEID> Return raw protocol records (no vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">connection)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/vehicle/<VEHICLEID> Connect to, and return vehicle information<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/vehicle/<VEHICLEID> Disconnect from vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/status/<VEHICLEID> Return vehicle status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/tpms/<VEHICLEID> Return toms status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/location/<VEHICLEID> Return vehicle location<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/charge/<VEHICLEID> Return vehicle charge status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/charge/<VEHICLEID> Set vehicle charge status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/charge/<VEHICLEID> Abort a vehicle charge<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/lock/<VEHICLEID> Return vehicle lock status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/lock/<VEHICLEID> Lock a vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/lock/<VEHICLEID> Unlock a vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/valet/<VEHICLEID> Return valet status<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/valet/<VEHICLEID> Enable valet mode<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DELETE /api/valet/<VEHICLEID> Disable valet mode<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/features/<VEHICLEID> Return vehicle features<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/feature/<VEHICLEID> Set a vehicle feature<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/parameters/<VEHICLEID> Return vehicle parameters<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/parameter/<VEHICLEID> Set a vehicle parameter<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/reset/<VEHICLEID> Reset the module in a particular vehicle<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PUT /api/homelink/<VEHICLEID> Activate home link<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/historical/<VEHICLEID> Request historical data summary<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">GET /api/historical/<VEHICLEID>/<DATATYPE> Request historical data records<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thoughts / suggestions?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Regards, Mark.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Begin forwarded message:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">From: Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Subject: [Ovmsdev] HTTP API<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Date: 18 February, 2013 9:41:15 AM HKT<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">To: OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Reply-To: OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">For some time now I've wanted to offer an HTTP API for OVMS. The existing<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">car<->server and server<->app protocol is cool, but requires going through<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">some hoops (perl, whatever) to handle the encryption and protocol level<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">stuff. An HTTP API would make this much easier to externally script, and<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">would be great for pulling down logs and other such things.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I've now completed work re-factoring the ovms_server.pl code to add the<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">framework to support this:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Switched to using the AnyEvent::HTTPD cpan module for the base framework.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Implemented an HTTP server on tcp/6868.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Implemented an HTTPS server on tcp/6869.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Support serving of arbitrary files (in httpfiles directory) for HTTP and<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">HTTPS.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Implemented syncing of Drupal user accounts (and password hashes) to new<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">ovms_owners table.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Extended the protocol to support syncing owners and well as vehicle records.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Support syncing ovms_owners table to connected OVMS servers.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Moved ovms_utilisation to ovms_historicalmessages as type<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'*-OVM-Utilisation", with records 0 (car_rx), 1 (car_tx), 2 (app_rx) and 3<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">(app_tx).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The above work has just been PUSHed to github.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">So, the framework exists. Now for the fun stuff.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">My thinking is:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Authenticate to a vehicle either by vehicle + serverpass, or OVMS<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">username+password.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">You can get a list of vehicles by providing your OVMS username+password.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Use cookies to maintain a session - and time sessions out after a few<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">minutes of inactivity (or on demand logout).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Basic functions to retrieve current vehicle status, and historical data.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Function to 'connect' to a live vehicle - just like an App, it will keep the<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">connection open for as long as the session lasts, then tell the vehicle you<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">have disconnected.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Control functions - just like the apps - start/stop charge, homelink, etc.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Support for OVMS protocol, so can convert the data messages to actual<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">real-world JSON.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Does anyone want to work with me on this? In particular, anyone with RESTful<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">or other HTTP API experience?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Regards, Mark.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">OvmsDev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote><br><br>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></div></blockquote></div><br></div></body></html>