111 lines
3.8 KiB
Markdown
111 lines
3.8 KiB
Markdown
# Overview
|
|
|
|
![aircon.sh in action](https://cube.nethack.net/images/aircon_control.png "aircon.sh in action")
|
|
|
|
Script to automate control of an home reverse cycle aircon system based on custom logic and temperature measurements.
|
|
|
|
This was originally written for an [AdvantageAir](https://www.advantageair.com.au/) system. It just calls an external script to interface with the aircon, so should be easily adaptable to other systems.
|
|
|
|
# Requirements
|
|
- [pymyair](https://github.com/smallsam/pymyair)
|
|
|
|
|
|
# Features
|
|
|
|
- Log temperature measurements to a CSV file or InfluxDB
|
|
- Control zone temperature by opening/closing its vents
|
|
- Control zone temperature by opening/closing vents in adjacent zones
|
|
- Automatically adjust aircon settings based on defined temperature thresholds
|
|
- Turn zones on/off based on ARP table entires for specific MAC addresses (for example, if a TV is turned on or a person's phone is detected)
|
|
- Define temperature rules based on weekday and/or time
|
|
|
|
# Usage
|
|
|
|
root@gridbug:~# scripts/aircon.sh -h
|
|
usage: scripts/aircon.sh [options]
|
|
|
|
Modifies aircon based on configured parameters in /root/.airconrc.
|
|
|
|
-h Show this text.
|
|
-c Cron mode. Only show output if actions were taken.
|
|
-i x.x.x.x Specify IP address for aircon (default is 10.99.99.1)
|
|
-I db Log all zone temperatures to given influxdb database, then exit (see -o).
|
|
-A db Log actions to given influxdb database.
|
|
-f file Specify an alternate config file.
|
|
-k file If file exists, never change aircon settings (default: /root/.aircon_noaction).
|
|
-l num Set number of too hot/cold zones at which to taking action.
|
|
-L Log all zone temperatures to CSV file, then exit (see -o).
|
|
-o file Specify CSV output file. Default: /root/acstats.csv
|
|
-m Generate a config file based on current aircon setup.
|
|
-p Profiler mode.
|
|
-w List which zone owners' devices are available then exit.
|
|
-t num Specify degrees below min temperature before taking action.
|
|
-T num Specify degrees above max temperature before taking action.
|
|
-y Actually run commands/db inserts. By default, commands are just displayed.
|
|
|
|
|
|
# Examples
|
|
|
|
## Sample .rc file
|
|
|
|
root@gridbug:~# cat .airconrc
|
|
|
|
options -t 0.5
|
|
|
|
modelock heat
|
|
|
|
constant Family
|
|
|
|
owner Study robsphone
|
|
owner Rob&Beth robsphone bethsphone
|
|
owner Brendan brendansphone
|
|
owner Media lgtv_wifi
|
|
|
|
@Thu-Fri;0830-1630 force Nursery close # Childcare hours
|
|
@1830-0630 temp Nursery 17-19
|
|
|
|
|
|
@0600-2359 temp Family 18-21
|
|
temp Media 18-22
|
|
temp Rob&Beth 18-22
|
|
@Mon-Fri;0830-1730 temp Study 18-22 # Rob working
|
|
@Sat-Sun ignore Study # Not working
|
|
2000-0700 temp Ben/Sewing 18-22
|
|
@Mon-Fri;0830-1730 temp Ben/Sewing 17-22 # Brendan working
|
|
|
|
adj Brendan Family
|
|
adj Media Brendan
|
|
adj Rob&Beth Family
|
|
adj Study Family
|
|
|
|
person Rob robsphone
|
|
person Beth bethsphone
|
|
person Brendan brendansphone
|
|
|
|
## Generate ~/.airconrcbased on your a tual aircon zones
|
|
bash$ aircon.sh -m
|
|
|
|
## Log temperature for each zone to csv then exit
|
|
bash$ aircon.sh -L -o /root/acstats.csv -x /usr/local/bin/pymyair -f /root/.airconrc
|
|
|
|
## Preview influxdb inserts for zone temperatures
|
|
bash$ aircon.sh -I myinfluxdb -y
|
|
|
|
## Log temperature for each zone to local influxdb then exit
|
|
bash$ aircon.sh -I myinfluxdb -y
|
|
|
|
## Determine required aircon changes and display them only (dry run)
|
|
bash$ aircon.sh
|
|
|
|
## Make required aircon changes
|
|
bash$ aircon.sh -y
|
|
|
|
## Make required aircon changes and log actions to influxdb
|
|
bash$ aircon.sh -y -A myinfluxdb
|
|
|
|
## Make required aircon changes and only produce output if actions taken (cron mdoe)
|
|
bash$ aircon.sh -y -c
|
|
|
|
|
|
|