Skip to content

Commit

Permalink
Account for different API versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Stricker committed Dec 27, 2023
1 parent 63c249b commit fea7e7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ When the adapter crashes or another Code error happens, this error message that
## Changelog
### **WORK IN PROGRESS**
- Added new section for WIFI settings. Some settings can be changed via the adapter.
- Account for different API versions

### 0.1.6 (2023-12-26)
- Account for different API versions
Expand Down
10 changes: 5 additions & 5 deletions lib/web_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class SrmClient {
}

/**
* Retrieve knowned devices by router and information like IP, signal, etc...
* Retrieve known devices by router and information like IP, signal, etc...
*
* @return {Promise<Object[]>} Devices
*/
Expand All @@ -261,7 +261,8 @@ class SrmClient {
} catch (error) {
if (error.message === 'This API version is not supported') {
if (api_version > 1){
this.getAllDevices(api_version - 1);
const nodes = (await this.getAllDevices(api_version - 1));
return nodes;
}
else{
throw new Error('This API version is not supported');
Expand All @@ -271,7 +272,6 @@ class SrmClient {
throw new Error(error.message);
}
}
return [];
}

/**
Expand Down Expand Up @@ -305,7 +305,8 @@ class SrmClient {
} catch (error) {
if (error.message === 'This API version is not supported') {
if (api_version > 1){
this.getMeshNodes(api_version - 1);
const nodes = await this.getMeshNodes(api_version - 1);
return nodes;
}
else{
throw new Error('This API version is not supported');
Expand All @@ -315,7 +316,6 @@ class SrmClient {
throw new Error(error.message);
}
}
return [];
}

/**
Expand Down

0 comments on commit fea7e7e

Please sign in to comment.