1
0
mirror of https://github.com/beestat/app.git synced 2025-05-23 18:04:14 -04:00

Added setting to prefer secondary device sync

This commit is contained in:
Jon Ziebell 2023-12-05 21:12:26 -05:00
parent 6f71b505cc
commit 70b82351a1
2 changed files with 30 additions and 0 deletions

View File

@ -120,6 +120,21 @@ class ecobee_sensor extends cora\crud {
];
try {
/**
* This will force the device sync to use the secondary method that uses
* the undocumented API calls instead of the normal GET "registered"
* thermostats. This fixes an issue where beestat never sees shared
* thermostats if there is at least one registered thermostat.
*/
$user = $this->api('user', 'get', $this->session->get_user_id());
if(
isset($user['settings']['app']) === true &&
isset($user['settings']['app']['prefer_secondary_device_sync']) === true &&
$user['settings']['app']['prefer_secondary_device_sync'] === true
) {
throw new cora\exception('No thermostats found.', 10511, false, null, false);
}
$response = $this->api(
'ecobee',
'ecobee_api',

View File

@ -83,6 +83,21 @@ class ecobee_thermostat extends cora\crud {
];
try {
/**
* This will force the device sync to use the secondary method that uses
* the undocumented API calls instead of the normal GET "registered"
* thermostats. This fixes an issue where beestat never sees shared
* thermostats if there is at least one registered thermostat.
*/
$user = $this->api('user', 'get', $this->session->get_user_id());
if(
isset($user['settings']['app']) === true &&
isset($user['settings']['app']['prefer_secondary_device_sync']) === true &&
$user['settings']['app']['prefer_secondary_device_sync'] === true
) {
throw new cora\exception('No thermostats found.', 10511, false, null, false);
}
$response = $this->api(
'ecobee',
'ecobee_api',