From 65d2de264ce666b1654067d9d509a00fcaed6900 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Tue, 17 Dec 2019 21:06:58 -0500 Subject: [PATCH] Fixed #199 - Runtime Detail max range error when selecting 30 days Increased the API limit to 31 days and left the GUI limit at 30 days. There are some edge cases where a few extra seconds can get added. --- api/runtime_thermostat.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/runtime_thermostat.php b/api/runtime_thermostat.php index 61d393b..97e9f92 100755 --- a/api/runtime_thermostat.php +++ b/api/runtime_thermostat.php @@ -601,7 +601,7 @@ class runtime_thermostat extends cora\crud { } $thermostat = $this->api('thermostat', 'get', $attributes['thermostat_id']); - $max_range = 2592000; // 30 days + $max_range = 2678000; // 31 days if ( ( is_array($attributes['timestamp']) === true && @@ -619,7 +619,7 @@ class runtime_thermostat extends cora\crud { strtotime($attributes['timestamp']['value']) - min(strtotime($thermostat['first_connected']), strtotime($thermostat['sync_begin'])) > $max_range ) ) { - throw new \Exception('Max range is 30 days.', 10205); + throw new \Exception('Max range is 31 days. ' . (time() - strtotime($attributes['timestamp']['value'])), 10205); } // Accept timestamps in roughly any format; always convert back to something nice and in UTC