add 'nomyzone' config option to prevent a zone from ever becoming the "myzone".
This commit is contained in:
parent
407af3f3e6
commit
6ff51f038e
18
aircon.sh
18
aircon.sh
|
@ -432,13 +432,21 @@ function generate_actions() { # populates global: nairconcommands & airconcmd
|
|||
if [[ -z $powerchange ]]; then
|
||||
if [[ $airconmode != "off" ]]; then
|
||||
mzmustmove=0
|
||||
# get list of all zones which can't be myzone
|
||||
nomyzone=""
|
||||
for x in ${!zname[@]}; do
|
||||
if [[ ${znomyzone[$x]} -eq 1 ]]; then
|
||||
nomyzone="$nomyzone ${zname[$x]} "
|
||||
fi
|
||||
done
|
||||
for x in ${!zname[@]}; do
|
||||
if [[ $airconmyzoneid == ${zid[$x]} || ${zaction[$x]} == *set_myzone* ]]; then
|
||||
if [[ ${zstate[$x]} == "close" || ${zaction[$x]} == *close_vent* ]]; then
|
||||
mzmustmove=1
|
||||
elif [[ ${zaction[@]} == *close:${zname[$x]}* ]]; then
|
||||
mzmustmove=1
|
||||
elif [[ ${znomyzone[$x]} -eq 1 ]]; then
|
||||
mzmustmove=1
|
||||
fi
|
||||
if [[ $mzmustmove -eq 1 ]]; then
|
||||
[[ $db -eq 1 ]] && info "myzone must move away from ${zname[$x]}"
|
||||
|
@ -633,6 +641,13 @@ function addnoop() {
|
|||
zignore[$idx]=1
|
||||
}
|
||||
|
||||
|
||||
function addnomyzone() {
|
||||
local idx
|
||||
idx=$(getidxfromname "$1")
|
||||
znomyzone[$idx]=1
|
||||
}
|
||||
|
||||
function addforcevent() {
|
||||
local x idx
|
||||
idx=$nforcevents
|
||||
|
@ -905,6 +920,8 @@ function load_config() {
|
|||
fi
|
||||
elif [[ ${tok[0]} == "adj" ]]; then
|
||||
addadj ${tok[1]} ${tok[@]:2}
|
||||
elif [[ ${tok[0]} == "nomyzone" || ${tok[0]} == "nomy" ]]; then
|
||||
addnnomyzone ${tok[1]}
|
||||
elif [[ ${tok[0]} == "noop" || ${tok[0]} == "ignore" ]]; then
|
||||
addnoop ${tok[1]}
|
||||
elif [[ ${tok[0]} == "force" ]]; then
|
||||
|
@ -981,6 +998,7 @@ function addzone() {
|
|||
zownerperson[$nzones]=$(getownerperson "$name")
|
||||
#info "zone $name owner is [${zowner[$nzones]}]"
|
||||
zignore[$nzones]=0
|
||||
znomyzone[$nzones]=0
|
||||
zpri[$nzones]=0
|
||||
wanttemp=$(gettemprange "$name")
|
||||
if [[ $wanttemp == "n/a" ]]; then
|
||||
|
|
Loading…
Reference in New Issue