Giter Club home page Giter Club logo

office_weather's Introduction

what & why?

Measuring Co2 and Temperature at Woogas office.

People are sensitive to high levels of Co2 or uncomfortably hot work environments, so we want to have some numbers. It turns out that our office does vary in temperature and Co2 across the floors.

requirements

hardware

  1. TFA-Dostmann AirControl Mini CO2 Messgerät -- 80 euro

  2. Raspberry PI 2 Model B -- 40 euro

  3. case, 5v power supply, microSD card

software

  1. Librato account for posting the data to.

  2. download Raspbian and install it on the microSD. We used this version of raspbian.

installation on the raspberry

  1. Boot the raspberry with the raspbian. You'll need a USB-keyboard, monitor and ethernet for this initial boot. After overcoming the initial configuration screen, you can login into the box using ssh.

  2. install python libs

sudo apt-get install python-pip
sudo pip install librato-metrics
sudo pip install pyyaml
sudo pip install requests
  1. create config.yaml with libratro credentials:
user: [email protected]
token: abc123...
prefix: office.floor3

We use librato to graph our weather, so you'll need to modify that if you using another service.

2b) (optional) You can configure this bot to automatically post to a Slack channel. Just add an "Incoming Webhook" to your Slack team's integrations and add a slack hash to the config file.

slack:
    webhook: 'https://hooks.slack.com/services/TXXXXXX/XXXXXX/xxxxxxx'
    channel: '#general'   # optional - this is the default value
    botname: 'CO2bot'     # optional - this is the default value
    icon: ':monkey_face:' # optional - this is the default value
    upper_threshold: 800  # optional - this is the default value
    lower_threshold: 600  # optional - this is the default value
  1. fix socket permissions
sudo chmod a+rw /dev/hidraw0
  1. run the script
./monitor.py /dev/hidraw0
  1. run on startup

To get everything working on startup, need to add 2 crontabs, one for root and the other for the pi user:

Roots:

SHELL=/bin/bash
* * * * * if [ $(find /dev/hidraw0 -perm a=rw | wc -l) -eq 0 ] ; then chmod a+rw /dev/hidraw0 ; fi

Pi:

SHELL=/bin/bash
* * * * * /usr/bin/python /home/pi/monitor.py /dev/hidraw0 [ **optional:** /home/pi/my_config.yaml ]  > /dev/null 2>&1

The script will default to using "config.yaml" (residing in the same directory as the monitor.py script - /home/pi in the example) for the librato credentials. You can optionally override this by passing a custom configuration file path as a second parameter.

credits

based on code by henryk ploetz

license

MIT

office_weather's People

Contributors

dvelopment avatar frennkie avatar tlossen avatar

Stargazers

 avatar

Watchers

 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.