Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.boschindego

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.boschindego - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

21

admin/jsonConfig.json

@@ -16,2 +16,3 @@ {

"pl": "E-mail aplikacji",
"uk": "Електронна пошта додатка",
"zh-cn": "应用电子邮件"

@@ -38,5 +39,24 @@ },

"pl": "Hasło do aplikacji",
"uk": "Пароль додатка",
"zh-cn": "应用密码"
}
},
"getMap": {
"type": "checkbox",
"newLine": true,
"sm": 3,
"label": {
"en": "Get Map",
"de": "Karte abrufen",
"ru": "Получить карту",
"pt": "Obter mapa",
"nl": "Kaart ophalen",
"fr": "Obtenir la carte",
"it": "Ottieni mappa",
"es": "Obtener mapa",
"pl": "Pobierz mapę",
"uk": "Отримати карту",
"zh-cn": "获取地图"
}
},

@@ -58,2 +78,3 @@ "interval": {

"pl": "Interwał aktualizacji (w minutach)",
"uk": "Інтервал оновлення (в хвилинах)",
"zh-cn": "更新间隔(分钟)"

@@ -60,0 +81,0 @@ }

26

io-package.json
{
"common": {
"name": "boschindego",
"version": "0.0.2",
"version": "0.1.0",
"news": {
"0.0.2": {
"0.1.0": {
"en": "initial release",
"de": "Erstveröffentlichung",
"ru": "Начальная версия",
"de": "erstausstrahlung",
"ru": "начальный выпуск",
"pt": "lançamento inicial",
"nl": "Eerste uitgave",
"fr": "Première version",
"it": "Versione iniziale",
"es": "Versión inicial",
"pl": "Pierwsze wydanie",
"uk": "Початкова версія",
"zh-cn": "首次出版"
"nl": "niet",
"fr": "initial release",
"it": "rilascio iniziale",
"es": "liberación inicial",
"pl": "pierwsze wydanie",
"uk": "початковий реліз",
"zh-cn": "初步释放"
}
},
"title": "Bosch Indego",
"titleLang": {

@@ -86,3 +85,4 @@ "en": "Bosch Indego",

"password": "",
"interval": 30
"interval": 30,
"getMap": false
},

@@ -89,0 +89,0 @@ "objects": [],

@@ -8,3 +8,2 @@ 'use strict';

const utils = require('@iobroker/adapter-core');
const crypto = require('crypto');
const axios = require('axios').default;

@@ -39,2 +38,4 @@ const qs = require('qs');

});
this.alerts = {};
this.lastState = {};
this.states = {

@@ -117,4 +118,2 @@ state: {

async login() {
let loginUrl = '';
const loginForm = await this.requestClient({

@@ -278,6 +277,6 @@ method: 'get',

'eUJTd67jRcuLcceDWLnOFX:APA91bE9FVtylJgX940k8dclGV7zQPs7-yPkI48ybPWbwDtVU9VDH3AenxIINeVm1NBifYMgspjAVzBkPD54oBcFmH29R3pCVhECF5GzTBjFKRa0oiY5XIHtoqDhE42D988NT2OZLM0J',
dvc_manuf: 'HUAWEI',
dvc_type: 'ANE-LX1',
dvc_manuf: 'SAMSUNG',
dvc_type: 'S901B/DS',
os_type: 'Android',
os_version: '9',
os_version: '13',
},

@@ -324,2 +323,77 @@ })

{ command: 'reset_alerts', name: 'True = Reset Alerts' },
{ command: 'calendar_get', name: 'True = Get' },
{
command: 'calendar_set',
name: 'Set Calendar as JSON',
type: 'string',
role: 'json',
def: `{
"sel_cal": 1,
"cals": [
{
"cal": 1,
"days": [
{
"day": 0,
"slots": [
{
"En": true,
"EnHr": 23,
"EnMin": 59,
"StHr": 22,
"StMin": 0
},
{
"En": true,
"EnHr": 8,
"EnMin": 0,
"StHr": 0,
"StMin": 0
}
]
},
{
"day": 1,
"slots": [
{
"En": true,
"EnHr": 23,
"EnMin": 59,
"StHr": 22,
"StMin": 0
},
{
"En": true,
"EnHr": 8,
"EnMin": 0,
"StHr": 0,
"StMin": 0
}
]
},
{
"day": 6,
"slots": [
{
"En": true,
"EnHr": 23,
"EnMin": 59,
"StHr": 22,
"StMin": 0
},
{
"En": true,
"EnHr": 8,
"EnMin": 0,
"StHr": 0,
"StMin": 0
}
]
}
]
}
]
}
`,
},
{ command: 'predictive_enable', name: 'True = Enable, False Disable' },

@@ -359,4 +433,4 @@ {

async updateDevices() {
const statusArray = [
async updateDevices(selection) {
let statusArray = [
{

@@ -373,6 +447,26 @@ path: 'state',

];
if (selection === 'calendar') {
statusArray = [
{
path: 'calendar',
url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/predictive/calendar',
desc: 'Calendar',
},
];
}
for (const id of this.deviceArray) {
if (
(this.config.getMap && this.lastState[id] == null) ||
(this.lastState[id] >= 500 && this.lastState[id] <= 799)
) {
statusArray.push({
path: 'map',
url: 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/$id/map',
desc: 'Map',
});
}
for (const element of statusArray) {
const url = element.url.replace('$id', id);
await this.requestClient({

@@ -389,2 +483,3 @@ method: element.method || 'get',

.then(async (res) => {
this.log.debug(url);
this.log.debug(JSON.stringify(res.data));

@@ -398,3 +493,8 @@ if (!res.data) {

const preferedArrayName = null;
if (element.path === 'alerts') {
this.alerts[id] = data;
}
if (element.path === 'state') {
this.lastState[id] = data.state;
}
this.json2iob.parse(id + '.' + element.path, data, {

@@ -417,5 +517,6 @@ forceIndex: forceIndex,

});
this.setState(element.path + '.json', JSON.stringify(data), true);
this.setState(id + '.' + element.path + '.json', JSON.stringify(data), true);
})
.catch((error) => {
this.log.debug(url);
if (error.response) {

@@ -503,3 +604,3 @@ if (error.response.status === 401) {

if (!state.ack) {
// const deviceId = id.split('.')[2];
const deviceId = id.split('.')[2];
const command = id.split('.')[4];

@@ -514,2 +615,81 @@ if (id.split('.')[3] !== 'remote') {

}
const type = command.split('_')[0];
const exec = command.split('_')[1];
let data = {};
let method = 'put';
const baseUrl = 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/' + deviceId;
const urlArray = [];
if (type === 'state') {
urlArray.push(baseUrl + '/state');
data = { state: exec };
}
if (type === 'predictive') {
if (exec === 'useradjustment') {
urlArray.push(baseUrl + '/predictive/useradjustment');
data = {
user_adjustment: state.val,
};
}
if (exec === 'enable') {
urlArray.push(baseUrl + '/predictive');
data = {
enabled: state.val,
};
}
}
if (type === 'reset') {
urlArray.push(baseUrl);
if (exec === 'blade') {
data = {
needs_service: false,
};
}
if (exec === 'alerts') {
method = 'delete';
for (const alert of this.alerts[deviceId]) {
urlArray.push(baseUrl + '/alerts/' + alert.id);
}
}
}
if (type === 'calendar') {
urlArray.push(baseUrl + '/predictive/calendar');
if (exec === 'get') {
this.updateDevices('calendar');
return;
}
if (exec === 'set') {
data = JSON.parse(state.val?.toString() || '{}');
}
}
for (const url of urlArray) {
this.log.debug(url);
await this.requestClient({
method: method,
url: url,
headers: {
'Content-Type': 'application/json; charset=UTF-8',
Connection: 'Keep-Alive',
'User-Agent': 'Indego-Connect_4.0.3.12955',
Authorization: 'Bearer ' + this.session.access_token,
'x-im-context-id': this.session.resource,
},
data: data,
})
.then(async (res) => {
this.log.debug(JSON.stringify(res.data));
})
.catch((error) => {
if (error.response && error.response.status === 504) {
this.log.warn('Device is offline');
return;
}
this.log.error(error);
error.response && this.log.error(JSON.stringify(error.response.data));
});
}
this.refreshTimeout && clearTimeout(this.refreshTimeout);
this.refreshTimeout = setTimeout(() => {
this.updateDevices();
}, 10 * 1000);
}

@@ -516,0 +696,0 @@ }

{
"name": "iobroker.boschindego",
"version": "0.0.2",
"version": "0.1.0",
"description": "Adapter for Bosch Indego Mower",

@@ -34,3 +34,2 @@ "author": {

"@alcalzone/release-script-plugin-manual-review": "^3.5.9",
"@iobroker/adapter-dev": "^1.2.0",
"@iobroker/testing": "^4.1.0",

@@ -80,3 +79,6 @@ "@tsconfig/node16": "^16.1.1",

},
"readmeFilename": "README.md"
"readmeFilename": "README.md",
"overrides": {
"axios": "^1.6.1"
}
}

@@ -18,2 +18,6 @@ ![Logo](admin/boschindego.png)

## Usage
Use id.remote.\* to control the mower
## Changelog

@@ -26,3 +30,3 @@

### **WORK IN PROGRESS**
### 0.1.0 (2023-11-11)

@@ -29,0 +33,0 @@ - (TA2k) initial release

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc