Skip to content

Commit

Permalink
Merge pull request #23 from Grizzelbee/development
Browse files Browse the repository at this point in the history
v1.1.4
  • Loading branch information
Grizzelbee authored Sep 4, 2023
2 parents 28ed6ed + 26d9425 commit c157b94
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 20 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.1.4 (2023-09-04)
* (grizzelbee) Fix: Attempting to fix the error: Cannot read properties of null (reading 'val')

### 1.1.3 (2023-09-01)
* (grizzelbee) New: Added release script for easier publishing to stable repo

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.1.3",
"version": "1.1.4",
"news": {
"1.1.4": {
"en": "Fix: Attempting to fix the error: Cannot read properties of null (reading 'val')",
"de": "Fix: Versuch, den Fehler zu beheben: Eigenschaften von Null können nicht gelesen werden (es wird „val“ gelesen)",
"ru": "Исправлено: попытка исправить ошибку: невозможно прочитать свойства со значением null (чтение «val»).",
"pt": "Correção: Tentativa de corrigir o erro: Não é possível ler propriedades de nulo (lendo 'val')",
"nl": "Oplossing: poging om de fout op te lossen: kan eigenschappen van null niet lezen (leest 'val')",
"fr": "Correctif : tentative de correction de l'erreur : impossible de lire les propriétés de null (lecture de 'val')",
"it": "Correzione: tentativo di correggere l'errore: impossibile leggere le proprietà di null (lettura 'val')",
"es": "Solución: intentando corregir el error: no se pueden leer las propiedades de nulo (leyendo 'val')",
"pl": "Poprawka: próba naprawienia błędu: nie można odczytać właściwości null (czytanie „val”)",
"uk": "Виправлення: спроба виправити помилку: неможливо прочитати властивості null (читання 'val')",
"zh-cn": "修复:尝试修复错误:无法读取 null 的属性(读取“val”)"
},
"1.1.3": {
"en": "New: Added release script for easier publishing to stable repo",
"de": "Neu: Release-Skript zur einfacheren Veröffentlichung im Stable Repo hinzugefügt",
Expand Down
52 changes: 34 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,22 @@ class Robonect extends utils.Adapter {
const timer = Number.parseInt(id.split('.', 4).pop())+1;
const basePath = id.split('.', 4).join('.');
let cmd = `timer&timer=${timer}&save=1`;
cmd += '&enable=' + ((await this.getValueAsync(`${basePath}.enabled`)) ? '1':'0');
cmd += '&start=' + (await this.getValueAsync(`${basePath}.start_time`));
cmd += '&end=' + (await this.getValueAsync(`${basePath}.end_time`));
// robonect.0.timer.0.weekdays.friday
cmd += '&mo=' + ((await this.getValueAsync(`${basePath}.weekdays.monday`)) ? '1':'0');
cmd += '&tu=' + ((await this.getValueAsync(`${basePath}.weekdays.tuesday`)) ? '1':'0');
cmd += '&we=' + ((await this.getValueAsync(`${basePath}.weekdays.wednesday`)) ? '1':'0');
cmd += '&th=' + ((await this.getValueAsync(`${basePath}.weekdays.thursday`)) ? '1':'0');
cmd += '&fr=' + ((await this.getValueAsync(`${basePath}.weekdays.friday`)) ? '1':'0');
cmd += '&sa=' + ((await this.getValueAsync(`${basePath}.weekdays.saturday`)) ? '1':'0');
cmd += '&su=' + ((await this.getValueAsync(`${basePath}.weekdays.sunday`)) ? '1':'0');
try {
cmd += '&enable=' + ((await this.getValueAsync(`${basePath}.enabled`)) ? '1' : '0');
cmd += '&start=' + (await this.getValueAsync(`${basePath}.start_time`));
cmd += '&end=' + (await this.getValueAsync(`${basePath}.end_time`));
// robonect.0.timer.0.weekdays.friday
cmd += '&mo=' + ((await this.getValueAsync(`${basePath}.weekdays.monday`)) ? '1' : '0');
cmd += '&tu=' + ((await this.getValueAsync(`${basePath}.weekdays.tuesday`)) ? '1' : '0');
cmd += '&we=' + ((await this.getValueAsync(`${basePath}.weekdays.wednesday`)) ? '1' : '0');
cmd += '&th=' + ((await this.getValueAsync(`${basePath}.weekdays.thursday`)) ? '1' : '0');
cmd += '&fr=' + ((await this.getValueAsync(`${basePath}.weekdays.friday`)) ? '1' : '0');
cmd += '&sa=' + ((await this.getValueAsync(`${basePath}.weekdays.saturday`)) ? '1' : '0');
cmd += '&su=' + ((await this.getValueAsync(`${basePath}.weekdays.sunday`)) ? '1' : '0');
}
catch(err){
this.log.error(err);
}
try {
await this.sendApiCmd(cmd);
await this.pollApi('timer');
Expand All @@ -387,16 +392,27 @@ class Robonect extends utils.Adapter {
}

async getValueAsync(id){
this.log.silly(`getValueAsync for id: ${id}`);
const state = await this.getStateAsync(id);
if (state) this.log.silly(`Returning value: ${state.val}`);
return state.val;
return new Promise((resolve, reject) => {
this.log.silly(`getValueAsync for id: ${id}`);
const state = this.getStateAsync(id);
if (state){
this.log.silly(`Returning value: ${state.val}`);
resolve (state.val);
} else {
reject(`The ID: ${id} has no value. Please fix.`);
}
});
}

async testPushServiceConfig(){
const url = await this.getValueAsync(`push.server_url`);
if (this.config.pushService && (url !== `${this.config.pushServiceIp}:${this.config.pushServicePort}`) ){
this.log.warn(`Push Service is enabled in config, but misconfigured. Please update your Robonect configuration.`);
try {
const url = await this.getValueAsync(`push.server_url`);
if (this.config.pushService && (url !== `${this.config.pushServiceIp}:${this.config.pushServicePort}`)) {
this.log.warn(`Push Service is enabled in config, but misconfigured. Please update your Robonect configuration.`);
}
}
catch(err){
this.log.error(err);
}
}

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.1.3",
"version": "1.1.4",
"description": "Robonect HX for lawn mower robots from Husquarna, Flymo, McCulloch and Gardena",
"keywords": [
"ioBroker",
Expand Down

0 comments on commit c157b94

Please sign in to comment.