Skip to content

jzhang-sre/auto_ac_ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto_ac_ansible

Auto AC... because the AC in my building isn't designed very well.

The AC unit in my apartment keeps the blower running even if the set temperature is reached, it only turns off the AC compressor when the set temperature is reached. This has the effect of warming up the apartment by blowing non-cooled air along with evaporating all the humidity the AC took out of the air and adding it back to the apartment.

Not the greatest level of control: image

Why not just use a smart outlet to control the AC, there are plenty of thermostat apps that work with smart outlets?

Unfortunately the AC units run on a 20 AMP plug and there are no 20 AMP smart outlets. I could do something similar with a relay controlled by a Pi but in case or error, I'd rather deal with the AC being on for too long or not at all versus a possible electrical fire.

Using two Pi Zero's, one as a temp sensor and one as a servo controller, the AC can be fully turned on and off based on more precise temperature readings. This also prevents the blower from running when the AC isn't on and cooling the apartment. Since there are two AC units in my apartment, multiple temperature sensors and controllers will be linked togheter to intellegently cool the apartment.

Future plans are to add a GUI front end to control the networked units and scheduling.

Hardware Used:

Initial Setup

This project uses Ansible to push out necessary dependencies and configuring the services.

Build Docker Container

  1. Clone repo
  2. In repo root, run docker build -t aac_container .

Set Credentials

The following variables will need to be set:

  • ansible_user: - pi login name (pi default is pi)
  • ansible_password: - pi password (pi default is raspberry)
  • ansible_become_pass: - pi password (pi default is raspberry)

Files where variables reside:

  • inventory\group_vars\all.yml

Setting the variables in plaintext works but is obviously insecure. You can use ansible-vault encrypt_string to keep your secrets encrypted. Do not press enter after your password, press ctrl-d twice.

bash$ ./sre ansible-vault encrypt_string --ask-vault-pass
New Vault password:
Confirm New Vault password:
Reading plaintext input from stdin. (ctrl-d to end input)
yourpassword!vault |
          $ANSIBLE_VAULT;1.1;AES256
          35373765373164393437356235323037663263393032623961303333373263346437653832363938
          3433386662356666643232646361633763336435633366610a616534623063643832316563353134
          34313565383338313763656163623432663862303766643037373839383466383930356436373439
          6231643335633036660a373933373937613834333537643939323963303661353466646566613439
          3064
Encryption successful

The resulting variable will be set like so:

ansible_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          35373765373164393437356235323037663263393032623961303333373263346437653832363938
          3433386662356666643232646361633763336435633366610a616534623063643832316563353134
          34313565383338313763656163623432663862303766643037373839383466383930356436373439
          6231643335633036660a373933373937613834333537643939323963303661353466646566613439
          3064
ansible_become_pass: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          35373765373164393437356235323037663263393032623961303333373263346437653832363938
          3433386662356666643232646361633763336435633366610a616534623063643832316563353134
          34313565383338313763656163623432663862303766643037373839383466383930356436373439
          6231643335633036660a373933373937613834333537643939323963303661353466646566613439
          3064

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published