1
0
mirror of https://github.com/beestat/app.git synced 2025-06-02 21:26:38 -04:00

Fixed #233 - Sync can sometimes miss data

Again.
This commit is contained in:
Jon Ziebell 2020-02-13 07:10:41 -05:00
parent 87cf3f042e
commit ac121dcb74

View File

@ -246,8 +246,12 @@ class runtime extends cora\api {
private function sync_forwards($thermostat_id) { private function sync_forwards($thermostat_id) {
$thermostat = $this->api('thermostat', 'get', $thermostat_id); $thermostat = $this->api('thermostat', 'get', $thermostat_id);
// Sync from the last data until now. // Sync from the last data until now. You would think going backwards in
$sync_begin = strtotime($thermostat['data_end']); // 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(); $sync_end = time();
$chunk_begin = $sync_begin; $chunk_begin = $sync_begin;