Skip to content

Commit

Permalink
0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Nov 17, 2023
1 parent 8de22ca commit 9c2ba0a
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 43 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -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": "начальный выпуск",
Expand Down
40 changes: 39 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -532,6 +562,14 @@ class Boschindego extends utils.Adapter {
}
}
}
addLocationtoMap(state, map) {
map = map.substr(0, map.length - 6); // remove </svg>
map =
map +
`<circle cx="${state.svg_xPos}" cy="${state.svg_yPos}" r="20" stroke="black" stroke-width="3" fill="yellow" /></svg>`;
map = map.replace('ry="0" fill="#FAFAFA"', 'ry="0" fill="#000" fill-opacity="0.0"');
return map;
}

async refreshToken() {
this.log.debug('Refresh token');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.boschindego",
"version": "0.1.0",
"version": "0.1.1",
"description": "Adapter for Bosch Indego Mower",
"author": {
"name": "TA2k",
Expand Down

0 comments on commit 9c2ba0a

Please sign in to comment.