/** * Heyu Action * */ function heyu_action($config, $theActionRequest, $theCode, $theState = null, $curr = null, $req = null) { // error_log("heyu_action ".$theActionRequest." - ".$req); $return_error = false; $hvac_validate = false; switch ($theActionRequest) { case "on": case "fon": $cmd = $config['heyuexecreal'] . " " . $config['cmd_on'] . " " . $theCode; break; case "foff": case "off": $cmd = $config['heyuexecreal'] . " " . $config['cmd_off'] . " " . $theCode; break; case "run": $cmd = $config['heyuexecreal'] . " " . $theCode; break; case "db": $cmd = dim_bright($config, $theState, $curr, $req, $theCode); break; case "dbapi": $cmd = dim_bright_real($config, $theState, $curr, $req, $theCode); break; case "hvac_control": $return_error = true; $hvac_validate = true; $cmd = rcs_control($config, $theCode, $req); break; default: return; break; } $rs = execute_cmd($cmd, $return_error); if ($hvac_validate) { $return_array = parse_hvac_return($rs, $req); } else { $return_array = $rs; } return $return_array; }
} echo "The hvac return line [" . $testLine[1] . "]<br/>"; echo "<br/>"; echo "* Test parse_hvac_return for mode<br/>"; try { $return_arr = parse_hvac_return(array($testLine[1]), "mode"); echo " The return of parse_hvac_return mode [" . $return_arr[0] . "]<br/>"; pr($return_arr); } catch (Exception $e) { echo " E!: " . $e->getMessage() . "<br/>"; } echo "The hvac return line [" . $testLine[2] . "]<br/>"; echo "<br/>"; echo "* Test parse_hvac_return for fan mode<br/>"; try { $return_arr = parse_hvac_return(array($testLine[2]), "fan_mode"); echo " The return of parse_hvac_return fan_mode [" . $return_arr[0] . "]<br/>"; pr($return_arr); } catch (Exception $e) { echo " E!: " . $e->getMessage() . "<br/>"; } echo "The hvac return line [" . $testLine[3] . "]<br/>"; echo "<br/>"; echo "* Test parse_hvac_return for setback mode<br/>"; try { $return_arr = parse_hvac_return(array($testLine[3]), "setback_mode"); echo " The return of parse_hvac_return setback_mode [" . $return_arr[0] . "]<br/>"; pr($return_arr); } catch (Exception $e) { echo " E!: " . $e->getMessage() . "<br/>"; }