-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·34 lines (30 loc) · 897 Bytes
/
Copy pathrun.sh
File metadata and controls
executable file
·34 lines (30 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="${SCRIPT_DIR}/.venv"
PYTHON="${VENV_DIR}/bin/python"
if [[ ! -x "${PYTHON}" ]]; then
python3 -m venv "${VENV_DIR}"
fi
"${PYTHON}" -m pip install --disable-pip-version-check -r "${SCRIPT_DIR}/requirements.txt"
# Subcommands:
# ./run.sh sensors [...] live humidity/temperature display
# ./run.sh control [...] humidity-driven AC automation (dry >65%, off <=54%)
# ./run.sh [...] Gree AC control (default; backward compatible)
case "${1:-}" in
sensors)
shift
exec "${PYTHON}" "${SCRIPT_DIR}/humidity_sensors.py" "$@"
;;
control)
shift
exec "${PYTHON}" "${SCRIPT_DIR}/humidity_control.py" "$@"
;;
web)
shift
exec "${PYTHON}" "${SCRIPT_DIR}/webapp.py" "$@"
;;
*)
exec "${PYTHON}" "${SCRIPT_DIR}/test.py" "$@"
;;
esac