diff --git a/README.md b/README.md
index 0a7e57b..05591e8 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,10 @@ Use id.remote.\* to control the mower
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
+### 1.3.2 (2025-01-03)
+
+- fix for login. If settings page is not loading, delete the instance and create a new instance.
+
### 1.3.1 (2024-11-28)
- Fix for Login
diff --git a/admin/index_m.html b/admin/index_m.html
new file mode 100644
index 0000000..32802ab
--- /dev/null
+++ b/admin/index_m.html
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Check Captcha Box and press Submit. Save the form.
+
+ If this is not working use the IP of the ioBroker instance in the browser and try again.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io-package.json b/io-package.json
index dd015cc..d84bde0 100644
--- a/io-package.json
+++ b/io-package.json
@@ -1,8 +1,21 @@
{
"common": {
"name": "boschindego",
- "version": "1.3.1",
+ "version": "1.3.2",
"news": {
+ "1.3.2": {
+ "en": "fix for login. If settings page is not loading, delete the instance and create a new instance.",
+ "de": "fix für Anmeldung. Wenn die Einstellungen nicht geladen werden, löschen Sie die Instanz und erstellen Sie eine neue Instanz.",
+ "ru": "починить для входа. Если страница настроек не загружается, удалите экземпляр и создайте новый экземпляр.",
+ "pt": "corrigir para login. Se a página de configurações não estiver carregando, exclua a instância e crie uma nova instância.",
+ "nl": "fix voor login. Als de instellingenpagina niet wordt geladen, verwijder dan de instantie en maak een nieuwe instantie aan.",
+ "fr": "correction pour la connexion. Si la page de configuration n'est pas chargée, supprimez l'instance et créez une nouvelle instance.",
+ "it": "fix per il login. Se la pagina delle impostazioni non viene caricata, cancella l'istanza e crea una nuova istanza.",
+ "es": "para iniciar sesión. Si la página de configuración no está cargando, elimine la instancia y cree una nueva instancia.",
+ "pl": "naprawić logowanie. Jeśli strona ustawień nie jest wczytywanie, usunąć instancję i utworzyć nową instancję.",
+ "uk": "фіксувати логін. Якщо сторінка налаштувань не завантажується, видаліть екземпляр і створіть новий екземпляр.",
+ "zh-cn": "用于登录的固定。 如果设置页面没有加载,请删除实例并创建新实例."
+ },
"1.3.1": {
"en": "Fix for Login",
"de": "Fix für den Login",
@@ -80,19 +93,6 @@
"pl": "Napraw lokalizację mapy",
"uk": "Карта сайту",
"zh-cn": "修复地图位置"
- },
- "1.1.1": {
- "en": "fix Login",
- "de": "Login Fix",
- "ru": "исправление",
- "pt": "corrigir Login",
- "nl": "aanmelden repareren",
- "fr": "correction de la connexion",
- "it": "correzione Login",
- "es": "fijación Iniciar sesión",
- "pl": "fix Login",
- "uk": "увійти",
- "zh-cn": "固定登录"
}
},
"titleLang": {
@@ -139,9 +139,6 @@
"compact": true,
"connectionType": "cloud",
"dataSource": "poll",
- "adminUI": {
- "config": "json"
- },
"dependencies": [
{
"js-controller": ">=5.0.19"
@@ -164,7 +161,8 @@
"username": "",
"password": "",
"interval": 30,
- "getMap": false
+ "getMap": false,
+ "captcha": ""
},
"objects": [],
"instanceObjects": [
diff --git a/main.js b/main.js
index 9669a3a..02d8af3 100644
--- a/main.js
+++ b/main.js
@@ -103,9 +103,18 @@ class Boschindego extends utils.Adapter {
this.session = {};
this.subscribeStates('*.remote.*');
- this.log.info('Login to Bosch Indego');
- await this.login();
-
+ const sessionState = await this.getStateAsync('auth.session');
+ if (sessionState && sessionState.val) {
+ this.session = JSON.parse(sessionState.val);
+ this.log.info(
+ 'Session found. If the login fails please delete boschindego.0.auth.session and restart the adapter',
+ );
+ this.log.debug(JSON.stringify(this.session));
+ await this.refreshToken();
+ } else {
+ this.log.info('Login to Bosch Indego');
+ await this.login();
+ }
if (this.session.access_token) {
await this.getDeviceList();
await this.updateDevices();
@@ -125,6 +134,10 @@ class Boschindego extends utils.Adapter {
}
async login() {
+ if (!this.config.captcha) {
+ this.log.error('Please set capcha in the instance settings');
+ return;
+ }
const loginForm = await this.requestClient({
method: 'get',
url: 'https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize',
@@ -216,6 +229,7 @@ class Boschindego extends utils.Adapter {
params: loginParams,
data: {
'UserIdentifierInput.EmailInput.StringValue': this.config.username,
+ 'h-captcha-response': this.config.captcha,
__RequestVerificationToken: formData['undefined'],
},
})
@@ -305,11 +319,23 @@ class Boschindego extends utils.Adapter {
response.code +
'&code_verifier=nw0c1JmU5rIszzrUOFj1BFvaqOynWrZ6ZHSVOMisZ7o&redirect_uri=msauth.com.bosch.indegoconnect.cloud://auth/&grant_type=authorization_code',
})
- .then((res) => {
+ .then(async (res) => {
this.log.debug(JSON.stringify(res.data));
this.session = res.data;
this.log.info('Login successful');
this.setState('info.connection', true, true);
+ await this.extendObject('auth.session', {
+ type: 'state',
+ common: {
+ name: 'Session Token',
+ type: 'string',
+ role: 'value',
+ read: true,
+ write: false,
+ },
+ native: {},
+ });
+ this.setState('auth.session', JSON.stringify(this.session), true);
})
.catch((error) => {
this.log.error('Code Exchange step faild');
@@ -679,13 +705,26 @@ class Boschindego extends utils.Adapter {
grant_type: 'refresh_token',
}),
})
- .then((res) => {
+ .then(async (res) => {
this.log.debug(JSON.stringify(res.data));
this.session = res.data;
this.log.debug('Refresh successful');
this.setState('info.connection', true, true);
+ await this.extendObject('auth.session', {
+ type: 'state',
+ common: {
+ name: 'Session Token',
+ type: 'string',
+ role: 'value',
+ read: true,
+ write: false,
+ },
+ native: {},
+ });
+ this.setState('auth.session', JSON.stringify(this.session), true);
})
.catch(async (error) => {
+ this.log.error('Refresh token faild. Please delete boschindego.0.auth.session and restart the adapter');
this.log.error(error);
error.response && this.log.error(JSON.stringify(error.response.data));
this.setStateAsync('info.connection', false, true);
diff --git a/package-lock.json b/package-lock.json
index 1cd45cc..2d42458 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "iobroker.boschindego",
- "version": "1.3.1",
+ "version": "1.3.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "iobroker.boschindego",
- "version": "1.3.1",
+ "version": "1.3.2",
"license": "MIT",
"dependencies": {
"@iobroker/adapter-core": "^3.2.2",
diff --git a/package.json b/package.json
index 53fc677..3beaf6c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iobroker.boschindego",
- "version": "1.3.1",
+ "version": "1.3.2",
"description": "Adapter for Bosch Indego Mower",
"author": {
"name": "TA2k",
@@ -69,5 +69,4 @@
"url": "https://github.com/iobroker-community-adapters/ioBroker.boschindego/issues"
},
"readmeFilename": "README.md"
-
}