Skip to content

measure co2 and temperature at the wooga office

Notifications You must be signed in to change notification settings

gorenje/office_weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 python-dev libyaml-dev
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

About

measure co2 and temperature at the wooga office

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages