I do temperature monitoring using my Raspberry Pi. These are the scripts to set everything up.
-
The Pi has Raspbian installed and you have SSH access.
-
You have Ansible installed on your local machine:
$ brew install ansible
-
You have an AWS account
-
In AWS, there's an IAM user who has the following permission:
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData" ], "Resource": ["*"] }] }
-
The IAM user has access credentials
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
- 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