Skip to content

Commit

Permalink
Merge pull request #15 from Grizzelbee/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Grizzelbee authored Aug 22, 2023
2 parents 5086a8b + ae89bf3 commit 727fdd9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ It is possible to control the extensions GPIO 1, GPIO 2, OUT 1 and OUT 2 of the
### Work in progress
* to use timePickers in admin at least admin version 6.4.3 is required - will implement as soon as admin >= 6.4.3 is in stable repo.

### 1.0.4 (2023-08-22)
* (grizzelbee) Upd: Improved error handling

### 1.0.3 (2023-08-21)
* (grizzelbee) Upd: Improved error handling
* (grizzelbee) Fix: some bug fixes
Expand Down
15 changes: 14 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "robonect",
"version": "1.0.3",
"version": "1.0.4",
"news": {
"1.0.4": {
"en": "Improved error handling",
"de": "Verbesserte Fehlerbehandlung",
"ru": "Улучшена обработка ошибок",
"pt": "Tratamento de erros aprimorado",
"nl": "Verbeterde foutafhandeling",
"fr": "Amélioration de la gestion des erreurs",
"it": "Gestione degli errori migliorata",
"es": "Manejo de errores mejorado",
"pl": "Ulepszona obsługa błędów",
"uk": "Покращена обробка помилок",
"zh-cn": "改进了错误处理"
},
"1.0.3": {
"en": "Improved error handling\nRenamed jsonConfig.json5 to jsonConfig.json to get better compatibility\nSome bug fixes",
"de": "Verbesserte Fehlerbehandlung\nJsonConfig.json5 in jsonConfig.json umbenannt, um eine bessere Kompatibilität zu erreichen\nEinige Fehlerbehebungen",
Expand Down
38 changes: 21 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,23 +384,28 @@ class Robonect extends utils.Adapter {
}

doErrorHandling(err){
const errorCode = err.error_code || err.response.status;
const errorMessage = err.error_message || err.message;
this.log.error(errorMessage);
switch (errorCode) {
case 253 : {
this.gpsPollType = 'NoPoll';
this.log.warn(`Your lawn mower dosen't support GPS. Deactivated polling of GPS. You should deactivate it in the adapters configuration.`);
break;
}
case 401 : {
this.log.error('Your Robonect has denied access due to incorrect credentials.');
this.log.error(`You used: Username=${this.username}, Password=${this.password} for login. Please double check your credentials and if they are correct - try using an easier password containing only upper- and lowercase letters and numbers.`);
this.terminate(11);
break;
try {
this.log.debug('Data received for error handling: '+JSON.stringify(err));
const errorCode = err.error_code || (err.response? err.response.status : -666);
const errorMessage = err.error_message || err.message;
this.log.error(errorMessage);
switch (errorCode) {
case 253 : {
this.gpsPollType = 'NoPoll';
this.log.warn(`Your lawn mower dosen't support GPS. Deactivated polling of GPS. You should deactivate it in the adapters configuration.`);
break;
}
case 401 : {
this.log.error('Your Robonect has denied access due to incorrect credentials.');
this.log.error(`You used: Username=${this.username}, Password=${this.password} for login. Please double check your credentials and if they are correct - try using an easier password containing only upper- and lowercase letters and numbers.`);
this.terminate(11);
break;
}
default:
this.log.warn('Error returned from Robonect device: '+JSON.stringify(err));
}
default:
this.log.warn('Error returned from Robonect device: '+JSON.stringify(err));
} catch(error){
this.log.error('Error during error handling: '+JSON.stringify(error));
}

}
Expand All @@ -420,7 +425,6 @@ class Robonect extends utils.Adapter {
adapter.log.debug('Data returned from robonect device: '+JSON.stringify(response.data));
if (response.data.successful === true) {
const objects = require('./lib/objects_' + cmd + '.json');

adapter.updateObjects(objects, response.data);
adapter.log.debug(`API call with command [${cmd}] - done!`);
resolve(response.data);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.robonect",
"version": "1.0.3",
"version": "1.0.4",
"description": "Robonect HX for lawn mower robots from Husquarna, Flymo, McCulloch and Gardena",
"keywords": [
"ioBroker",
Expand Down

0 comments on commit 727fdd9

Please sign in to comment.