GithubHelp home page GithubHelp logo

connectit's Introduction

ConnectIT

Ingram Mirco Case Competition

Problem Statement

Maxwell, head of Building Operations at 55 Standish Court, Mississauga, Ontario, is experiencing some problems with getting insight into the building systems. Everything is reactive. Some of the issues that have occurred include the HVAC system breaking down twice in November and the elevator failing at least once per week over four weeks. Occupancy comfort is also an issue – sometimes, it’s too hot, and other times, it’s just so cold that the occupants need a sweater! There have also been several cases of water leakage that caused severe damages. Your goal is to help Maxwell gain real operational insight with an early warning system. Help him become the proactive Building Operations Manager he wants to be. What would you recommend to Maxwell?

Solution

Very vague problem, I know :|

So we decided to create a two part solution. The first being a concept idea using a sensor relay to make issues with the building interconnected through different measurements; air pressure, temperature, humidity, etc. We will then connect these sensors to a router to collect data from around the building. We will have this data accessible to Maxwell with a dashboard and implement a machine learning backend to figure out why the problems occurred by taking into account the frequency, intensity, and location of the data.

The second part is our more tangible end user experience. For this we created a simple python script utilizing Twillo API and Google Drive API. With these we used the gspread package made by Anton Burnashev to read the spreadsheet data to later be sent out as alerts to Maxwell's phone! This solution allows for CRUD processes. The package could be uploaded to DigitalOcean or AWS.

SETUP

Make an account on twillo.com to get; account_sid: auth_token: Phone number: We will use these to integrate the twillo API

Next we want to be able to access our spreadsheet data and to do this we will need to create a service account and OAuth2 credentials from the Google API console.

  1. Visit https://console.developers.google.com/
  2. Create a new project
  3. Go to "Enable API" and search for Google Drive API. As you might have guessed you will want to enable it!
  4. Now click "Create credentials". In the dropdowns select "Web Server" and bubble in "Application Data"
  5. Give the service account a name so you can reference it easier and give it "Project" then "Editor" roles after
  6. Download the client_secret.JSON file and replace it with the clien_secret_blank.JSON I have left in the project folder

Now that you have the JSON file you need to actually complete one more step so that the service account can access your specific spreadsheet.

  1. Open the client_secret.json and copy the string inside of the client_email field.
  2. Open your spreadsheet and click share, and copy the client_email in with edit perms.

INSTALL THESE PACKAGES (I used Git Bash)

  $pip install gspread
  $pip install oauth2client
  $pip install twillo

We implement these with the following code in the spreadsheet_to_SMS.py:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

This segment is for the twillo implementation:

from twilio.rest import TwilioRestClient
account_sid = "ENTER YOUR account_sid HERE"
auth_token = "ENTER YOUR auth_token HERE"
clienttwillo = TwilioRestClient(account_sid, auth_token)

This segment is for giving the service account credentials and to locate the scope:

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)

This segment is to open the specific spreadsheet in your drive and to extract the data to a list:

sheet = client.open("ENTER YOUR SPREADSHEET NAME HERE").sheet1
list_of_hashes = sheet.get_all_records()
print(list_of_hashes)

HAVE FUN WITH IT!

Feel free to use this code if you ever need to take data out of a google spreadsheet and to send certain cells out as a SMS message! Send me the creative stuff you make, I'd love to take a look at it :) Check out https://gspread.readthedocs.io/en/latest/ to see what you can do with gspread!

connectit's People

Contributors

danielmrtnvc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.