1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #287 - Sync fails if first chunk of data has no viable rows

This commit is contained in:
Jon Ziebell 2020-06-23 22:30:05 -04:00
parent 8caaa185be
commit 1f0d6e267b

View File

@ -92,16 +92,22 @@ class runtime extends cora\api {
1 1
); );
$this->api( // Don't attempt this update if nothing was returned. This can happen
'thermostat', // if data is returned from ecobee for the first time period but none
'update', // of it was valid.
[ if(count($runtime_thermostats) === 1) {
'attributes' => [ $this->api(
'thermostat_id' => $thermostat_id, 'thermostat',
'data_begin' => $runtime_thermostats[0]['timestamp'] 'update',
[
'attributes' => [
'thermostat_id' => $thermostat_id,
'data_begin' => $runtime_thermostats[0]['timestamp']
]
] ]
] );
); }
} else { } else {
$this->sync_backwards($thermostat_id); $this->sync_backwards($thermostat_id);
} }