get_aircon_info: zones=$(myair $AIRCON_IP zones | jq -r '.[] | [ .name, .state, .setTemp, .measuredTemp, .number ] | @csv' | tr -d '" ') airconmode=$(myair $AIRCON_IP mode) airconmyzoneid=$(myair $AIRCON_IP myzone) curl http://10.99.99.1:2025/getSystemData | jq '.aircons.ac1.zones[] | [ .name, .state, .setTemp, .measuredTemp, .number ]' | jq .aircons.ac1.info.mode | jq .aircons.ac1.info.myZone from show_proposed_commands: for x in ${!airconcmd[@]}; do fullcmd="myair $AIRCON_IP ${airconcmd[$x]}" add_aircon_command $idx -1 "Power on system" "on" /setAircon?json={"ac1":{"info":{"state":"on"}}} add_aircon_command $idx -1 "Power off system" "off" /setAircon?json={"ac1":{"info":{"state":"off"}}} example:::: http://10.0.0.10:2025/setAircon?json={ac1:{"info":{"state":"on","mode":"cool"},"zones":{"z10":{"value":80}}}}} add_aircon_command $idx -1 "Set MyZone to ${zname[$idx]}" "myzone --zone ${zid[$idx]}" setAircon?json={ac1:{"info":{"myZone":xxxxxxx}}} add_aircon_command $idx $otheridx "Open vent in ${zname[$otheridx]}" "set --zone ${otherid} --state on --temp ${zsettemp[$otheridx]}" setAircon?json={ac1:{"zones":{"z00":{"state":"open","setTemp",xxx}}}} add_aircon_command $idx $otheridx "Close vent in ${zname[$otheridx]}" "set --zone ${otherid} --state off --temp ${zsettemp[$otheridx]}" setAircon?json={ac1:{"zones":{"z00":{"state":"close","setTemp",xxx}}}} add_aircon_command $idx -1 "Set system mode to '$str'" "$str" setAircon?json={ac1:{"info":{"mode":"heat"}}} add_aircon_command $idx -1 "In zone ${zname[$idx]}, $comm" "set --zone ${zid[$idx]}$toadd" # add_aircon_command zone_idx "comment goes here" "actual pymyair command to run" function add_aircon_command() { pass a json to add_aircon_cmd wrap in: { "ac1":{ xxxxxxx } } merge all jsons with: jq -s '.[0] * .[1] * .[2] * .[3]' base 1 2 3 pass to aircon in a single call from run_commands: for x in ${!airconcmd[@]}; do [[ -n ${airconcomment[$x]} ]] && action "${airconcomment[$x]}" echo RUNNING myair $AIRCON_IP ${airconcmd[$x]} from base: if [[ $showwho -eq 0 ]]; then if [[ -z $MYAIR ]]; then MYAIR=$(which myair) if [[ $? -ne 0 ]]; then error "Can't find pymyair executable 'myair' in path. Install it from here: https://github.com/smallsam/pymyair" exit 1