From 9c2ba0adf75a6e4a749d481f245cb9e805226e8c Mon Sep 17 00:00:00 2001 From: TA2k Date: Fri, 17 Nov 2023 20:49:40 +0100 Subject: [PATCH] 0.1.1 --- .github/workflows/test-and-release.yml | 70 +++++++++++++------------- README.md | 5 +- io-package.json | 4 +- main.js | 40 ++++++++++++++- package-lock.json | 4 +- package.json | 2 +- 6 files changed, 82 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 9b2317b..460ceb4 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -55,38 +55,38 @@ jobs: # Enter this token as a GitHub secret (with name NPM_TOKEN) in the repository options # Then uncomment the following block: -# # Deploys the final package to NPM -# deploy: -# needs: [check-and-lint, adapter-tests] -# -# # Trigger this step only when a commit on any branch is tagged with a version number -# if: | -# contains(github.event.head_commit.message, '[skip ci]') == false && -# github.event_name == 'push' && -# startsWith(github.ref, 'refs/tags/v') -# -# runs-on: ubuntu-latest -# -# # Write permissions are required to create Github releases -# permissions: -# contents: write -# -# steps: -# - uses: ioBroker/testing-action-deploy@v1 -# with: -# node-version: '18.x' -# # Uncomment the following line if your adapter cannot be installed using 'npm ci' -# # install-command: 'npm install' -# npm-token: ${{ secrets.NPM_TOKEN }} -# github-token: ${{ secrets.GITHUB_TOKEN }} -# -# # When using Sentry for error reporting, Sentry can be informed about new releases -# # To enable create a API-Token in Sentry (User settings, API keys) -# # Enter this token as a GitHub secret (with name SENTRY_AUTH_TOKEN) in the repository options -# # Then uncomment and customize the following block: -# sentry: true -# sentry-token: ${{ secrets.SENTRY_AUTH_TOKEN }} -# sentry-project: "iobroker-boschindego" -# sentry-version-prefix: "iobroker.boschindego" -# # If your sentry project is linked to a GitHub repository, you can enable the following option -# # sentry-github-integration: true + # Deploys the final package to NPM + deploy: + needs: [check-and-lint, adapter-tests] + + # Trigger this step only when a commit on any branch is tagged with a version number + if: | + contains(github.event.head_commit.message, '[skip ci]') == false && + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags/v') + + runs-on: ubuntu-latest + + # Write permissions are required to create Github releases + permissions: + contents: write + + steps: + - uses: ioBroker/testing-action-deploy@v1 + with: + node-version: '18.x' + # Uncomment the following line if your adapter cannot be installed using 'npm ci' + # install-command: 'npm install' + npm-token: ${{ secrets.NPM_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + # When using Sentry for error reporting, Sentry can be informed about new releases + # To enable create a API-Token in Sentry (User settings, API keys) + # Enter this token as a GitHub secret (with name SENTRY_AUTH_TOKEN) in the repository options + # Then uncomment and customize the following block: + sentry: true + sentry-token: ${{ secrets.SENTRY_AUTH_TOKEN }} + sentry-project: "iobroker-boschindego" + sentry-version-prefix: "iobroker.boschindego" + # If your sentry project is linked to a GitHub repository, you can enable the following option + # sentry-github-integration: true diff --git a/README.md b/README.md index a8dec47..f0c776a 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,11 @@ [![NPM](https://nodei.co/npm/iobroker.boschindego.png?downloads=true)](https://nodei.co/npm/iobroker.boschindego/) **Tests:** ![Test and Release](https://github.com/iobroker-community-adapters/ioBroker.boschindego/workflows/Test%20and%20Release/badge.svg) +**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0. ## boschindego adapter for ioBroker -Adapter for Bosch Indego Mower +Adapter for Bosch Indego Mower to show the state of the mower and control the mower. ## Usage @@ -26,7 +27,7 @@ Use id.remote.\* to control the mower ### **WORK IN PROGRESS** --> -### 0.1.0 (2023-11-11) +### 0.1.1 (2023-11-11) - (TA2k) initial release diff --git a/io-package.json b/io-package.json index 21be465..a31892f 100644 --- a/io-package.json +++ b/io-package.json @@ -1,9 +1,9 @@ { "common": { "name": "boschindego", - "version": "0.1.0", + "version": "0.1.1", "news": { - "0.1.0": { + "0.1.1": { "en": "initial release", "de": "erstausstrahlung", "ru": "начальный выпуск", diff --git a/main.js b/main.js index cc4c530..fe977bb 100644 --- a/main.js +++ b/main.js @@ -80,6 +80,10 @@ class Boschindego extends utils.Adapter { this.log.info('Set interval to minimum 0.5'); this.config.interval = 0.5; } + if (this.config.interval > 2147483647) { + this.log.info('Set interval to maximum 2147483647'); + this.config.interval = 2147483647; + } if (!this.config.username || !this.config.password) { this.log.error('Please set username and password in the instance settings'); return; @@ -143,6 +147,9 @@ class Boschindego extends utils.Adapter { error.response && this.log.error(JSON.stringify(error.response.data)); }); + if (!loginForm) { + return; + } const singleIdUrl = await this.requestClient({ method: 'get', url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/unified', @@ -437,6 +444,26 @@ class Boschindego extends utils.Adapter { url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alerts', desc: 'Alerts', }, + { + path: 'predictive', + url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/predictive', + desc: 'Predictive', + }, + { + path: 'operatingData', + url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/operatingData', + desc: 'Operating Data', + }, + { + path: 'lastcutting', + url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/predictive/lastcutting', + desc: 'Last Cutting', + }, + { + path: 'nextcutting', + url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/predictive/nextcutting', + desc: 'Next Cutting', + }, ]; if (selection === 'calendar') { @@ -478,7 +505,7 @@ class Boschindego extends utils.Adapter { if (!res.data) { return; } - const data = res.data; + let data = res.data; const forceIndex = true; const preferedArrayName = null; @@ -488,6 +515,9 @@ class Boschindego extends utils.Adapter { if (element.path === 'state') { this.lastState[id] = data.state; } + if (element.path === 'map') { + data = this.addLocationtoMap(this.lastState[id], data); + } this.json2iob.parse(id + '.' + element.path, data, { forceIndex: forceIndex, preferedArrayName: preferedArrayName, @@ -532,6 +562,14 @@ class Boschindego extends utils.Adapter { } } } + addLocationtoMap(state, map) { + map = map.substr(0, map.length - 6); // remove + map = + map + + ``; + map = map.replace('ry="0" fill="#FAFAFA"', 'ry="0" fill="#000" fill-opacity="0.0"'); + return map; + } async refreshToken() { this.log.debug('Refresh token'); diff --git a/package-lock.json b/package-lock.json index c7d97c3..f580f0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "iobroker.boschindego", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "iobroker.boschindego", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@iobroker/adapter-core": "^3.0.4", diff --git a/package.json b/package.json index d04fb48..f1b2b45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.boschindego", - "version": "0.1.0", + "version": "0.1.1", "description": "Adapter for Bosch Indego Mower", "author": { "name": "TA2k",