From ac121dcb7475ccec64e40d58bf2a429aec9e10dd Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Thu, 13 Feb 2020 07:10:41 -0500 Subject: [PATCH] Fixed #233 - Sync can sometimes miss data Again. --- api/runtime.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/runtime.php b/api/runtime.php index 89b7607..b340ca7 100644 --- a/api/runtime.php +++ b/api/runtime.php @@ -246,8 +246,12 @@ class runtime extends cora\api { private function sync_forwards($thermostat_id) { $thermostat = $this->api('thermostat', 'get', $thermostat_id); - // Sync from the last data until now. - $sync_begin = strtotime($thermostat['data_end']); + // Sync from the last data until now. You would think going backwards in + // time is unnecessary, but there have been some ecobee bugs where their API + // returns the wrong data. Frankly, this is easier than trying to be super + // precise and then missing data. Three hours should be enough to catch + // everything. + $sync_begin = strtotime($thermostat['data_end'] . ' -3 hour'); $sync_end = time(); $chunk_begin = $sync_begin;