diff --git a/api/ecobee.php b/api/ecobee.php index ddce844..b597f7f 100644 --- a/api/ecobee.php +++ b/api/ecobee.php @@ -62,12 +62,11 @@ class ecobee extends external_api { $ecobee_token ); - $guids = []; + $identifiers = []; $email_addresses = []; foreach($response['thermostatList'] as $thermostat) { $runtime = $thermostat['runtime']; - $guid = sha1($thermostat['identifier'] . $runtime['firstConnected']); - $guids[] = $guid; + $identifiers[] = $thermostat['identifier']; $notification_settings = $thermostat['notificationSettings']; $email_addresses = array_merge($email_addresses, $notification_settings['emailAddresses']); @@ -79,7 +78,7 @@ class ecobee extends external_api { $existing_ecobee_thermostats = $this->database->read( 'ecobee_thermostat', [ - 'guid' => $guids + 'identifier' => $identifiers ] ); diff --git a/api/ecobee_sensor.php b/api/ecobee_sensor.php index 78c5fe5..5b949b3 100644 --- a/api/ecobee_sensor.php +++ b/api/ecobee_sensor.php @@ -100,14 +100,12 @@ class ecobee_sensor extends cora\crud { // Loop over the returned sensors and create/update them as necessary. $sensor_ids_to_keep = []; foreach($response['thermostatList'] as $thermostat_api) { - $guid = sha1($thermostat_api['identifier'] . $thermostat_api['runtime']['firstConnected']); - $ecobee_thermostat = $this->api( 'ecobee_thermostat', 'get', [ 'attributes' => [ - 'guid' => $guid + 'identifier' => $thermostat_api['identifier'] ] ] ); diff --git a/api/ecobee_thermostat.php b/api/ecobee_thermostat.php index d191bf0..d58b4fb 100644 --- a/api/ecobee_thermostat.php +++ b/api/ecobee_thermostat.php @@ -100,11 +100,9 @@ class ecobee_thermostat extends cora\crud { // Loop over the returned thermostats and create/update them as necessary. $thermostat_ids_to_keep = []; foreach($response['thermostatList'] as $api_thermostat) { - $guid = sha1($api_thermostat['identifier'] . $api_thermostat['runtime']['firstConnected']); - $ecobee_thermostat = $this->get( [ - 'guid' => $guid + 'identifier' => $api_thermostat['identifier'] ] ); @@ -123,7 +121,7 @@ class ecobee_thermostat extends cora\crud { else { // Thermostat does not exist. $ecobee_thermostat = $this->create([ - 'guid' => $guid + 'identifier' => $api_thermostat['identifier'] ]); $thermostat = $this->api( 'thermostat',