JTK – Notes and Ramblings Things we have found …

5/13/2020

Lightning + Google

Filed under: General,Home Automation — taing @ 1:45 pm

Based on the trick seen here we have added Google Sheets logging to the lightning Python script.

A copy of the example sheet in the original GitHub with a few changes to the column headers, publish the API and that side is all set.

For the Python side we needed to “import urllib.request” and request the url. Then is was as simple as “r = urllib.request.urlopen(urlStr+outStr)”. In this case urlStr is the url from Google and outStr is the data. For example, ‘?type=”Strike”&distance=32&energy=200’.

When publishing the Google Sheet Web API the simple choice is anonymous. I have not looked at handling credentials for Google login in the Python script.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress