Ole8700 / openhab

Automatically exported from code.google.com/p/openhab
GNU General Public License v3.0
1 stars 0 forks source link

Google Drive persistence #229

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Feature Description

I've added a Google Drive persistence component.  I use it to push status of 
thermostat and temperature data to Google spreadsheets and create charts off of 
the data.
It uses OAuth2.0 authorization (OAuth2.0 for devices) to write data to 
individuals own Drive.
Repo at: https://code.google.com/r/tom-openhab-clone/
Looking forward to feedback from others so I can enhance/extend where needed.
Note: actual persistence happens at specific intervals (specified in 
openhab.cfg).  Drive.persist configures which items should be persisted and 
keeps them ready in a separate cache.

2. Example Use Case

* retain historical data in an accessible manner
* use spreadsheet charts to plot charts for your data (e.g. temperature, etc..)
* reuse data from your home automation with any other application that can work 
with Google Drive.  There are many.

Original issue reported on code.google.com by t...@ducbase.com on 5 Apr 2013 at 11:17

GoogleCodeExporter commented 9 years ago
Sounds great! Will have a look at the code and provide feedback as soon as I 
find time (unfortunately not before the 1.2 Release anymore, sorry...)

Original comment by kai.openhab on 8 Apr 2013 at 9:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by kai.openhab on 4 Jul 2013 at 7:44

GoogleCodeExporter commented 9 years ago

Original comment by kai.openhab on 11 Aug 2013 at 7:29

GoogleCodeExporter commented 9 years ago
Hi Tom,

it took seemingly forever, but now I am finally looking at your service and it 
is really amazing :-)
I would like to include it in 1.3, but I have one question before that: Are all 
the libraries in the lib folder really required? Quite a few should be 
available in openHAB already (guava, commons-logging, httpclient, httpcore, 
jackson, mailapi, activation...) - did you check if the code would work with 
import package statements instead of including these libs?

Regards,
Kai

Original comment by kai.openhab on 30 Aug 2013 at 9:07

GoogleCodeExporter commented 9 years ago
Upload does not seem to work for me - it created a spreadsheet based on my 
template, but then I get:
10:32:04.760 DEBUG o.o.p.drive.internal.UploadJob[:206] - Looking for 
spreadsheet [openhab_352013]
10:32:05.268 DEBUG o.o.p.drive.internal.UploadJob[:115] - 
KEY[Weather_Temp_Min]:VALUE[15]
10:32:05.268 DEBUG o.o.p.drive.internal.UploadJob[:115] - 
KEY[Weather_Temperature]:VALUE[19]
10:32:05.268 DEBUG o.o.p.drive.internal.UploadJob[:115] - 
KEY[Weather_Temp_Max]:VALUE[19]
10:32:07.216 ERROR o.o.p.drive.internal.UploadJob[:95] - Unable to upload data
com.google.gdata.util.InvalidEntryException: Bad Request
    at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:602)
    at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
    at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
    at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
    at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
    at com.google.gdata.client.Service.insert(Service.java:1409)
    at com.google.gdata.client.GoogleService.insert(GoogleService.java:613)
    at org.openhab.persistence.drive.internal.UploadJob.upload(UploadJob.java:124)
    at org.openhab.persistence.drive.internal.UploadJob.execute(UploadJob.java:91)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)

Any ideas?

Original comment by kai.openhab on 31 Aug 2013 at 8:35

GoogleCodeExporter commented 9 years ago
Hi Kai,

I haven't checked which libraries can go... I just follow instructions by
google as to which libraries to add.  I was reluctant to leave out
libraries since some might only be needed in specific situations and lead
to bugs for untested scenarios.  For those libraries already included in
the framework, it might be safe to leave them out.

As far as the stacktrace: too bad this doesn't work out of the box :(
 However it does appear that the authentication logic is working since
there's a sheet created for you.  That's a good sign since the OAuth stuff
was most complicated.
I do know had to be very specific about things like date formats (e.g.
UploadJob line 120), maybe it doesn't like the hardcoded format if your
using a different locale in your Google Drive account?  Maybe more debug
messaging might add clarity?

It's been working for me since I published this code.  So it must be
something specific to your configuration or account? If you let me know
what your google account (email) is, I'll share my template and the live
document that's being updated by my installation here... you can use this
to compare with your template/document.  I haven't touched the code for a
while now, so am a bit rusty.  I'll help where I can!

Original comment by t...@ducbase.com on 1 Sep 2013 at 11:09

GoogleCodeExporter commented 9 years ago
Thanks for your account id, Kai. I've shared the template and this weeks live 
document.

Original comment by t...@ducbase.com on 2 Sep 2013 at 8:09

GoogleCodeExporter commented 9 years ago
I couldn't yet make it work - together with refactoring of the included libs, I 
am afraid there is too much effort left to get this into the 1.3 release. I'll 
thus postpone its integration for the moment.

Original comment by kai.openhab on 6 Sep 2013 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by teichsta on 5 Nov 2013 at 10:47

GoogleCodeExporter commented 9 years ago
This issue has been migrated to Github. If this issue id is greater than103 its 
id has been preserved on Github. You can open your issue by calling the URL 
https://github.com/openhab/openhab/issues/<issueid>. Issues with ids less or 
equal 103 new ids were created.

Original comment by teichsta on 17 Nov 2013 at 8:08

GoogleCodeExporter commented 9 years ago
see above!

Issue has been migrated to Github and should be discussed there.

Original comment by teichsta on 21 Nov 2013 at 1:51