From 81be72bb8bea76f171bae7ec57fa8bb46b4cfeb9 Mon Sep 17 00:00:00 2001 From: mtan93 <30936296+mtan93@users.noreply.github.com> Date: Tue, 11 Dec 2018 18:08:48 +0000 Subject: [PATCH] Create cancel_hot_water.php --- cancel_hot_water.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cancel_hot_water.php diff --git a/cancel_hot_water.php b/cancel_hot_water.php new file mode 100644 index 0000000..879a2bb --- /dev/null +++ b/cancel_hot_water.php @@ -0,0 +1,30 @@ +format('Y-m-d H:i:s'); +// Check if a key has been sent? +if (empty($_GET['key'])) { + $return = json_encode( array("error"=>array( "code"=>401, "text"=>"Access Denied", "message"=>"The key was missing" ))); +} +// If it has check if it is correct +else if ($_GET['key']==$access_key) { + $nest = new Nest($nest_username,$nest_password); + $return = $nest->setHotWaterBoost(0); +} +//If not correct one has been passed but it is wrong +else { + $return = json_encode( array("error"=>array( "code"=>401, "text"=>"Access Denied", "message"=>"The key was wrong" ))); +} + +// return json response and log to testing file +echo $return; +file_put_contents("test.txt","$str_date $return", FILE_APPEND); + +?>