/weatherman

Use your Raspberry Pi as weather station, monitor measurements in AWS CloudWatch

Primary LanguagePython

Weatherman

I do temperature monitoring using my Raspberry Pi. These are the scripts to set everything up.

Assumptions

  1. The Pi has Raspbian installed and you have SSH access.

  2. You have Ansible installed on your local machine:

    $ brew install ansible
    
  3. You have an AWS account

  4. In AWS, there's an IAM user who has the following permission:

     {
       "Version": "2012-10-17",
       "Statement": [{
         "Effect": "Allow",
         "Action": [
           "cloudwatch:PutMetricData"
         ],
         "Resource": ["*"]
       }]
     }
  5. The IAM user has access credentials

What to do

First run:

$ ansible-playbook --ask-pass -i raspberrypi, pi.yml --extra-vars "aws_access_key_id=xxx aws_secret_access_key=yyy room=bedroom"

Subsequent runs:

ansible-playbook -i raspberrypi, pi.yml --skip-tags=credentials

What this does

  • compiles the library to read temperature and humidity from the sensor
  • reads data from the sensor and outputs it as JSON
  • JSON is fed into the AWS Command-line interface which sends data to AWS CloudWatch
  • adds a crontab entry to do all this every minute