From 565721171623d3a1a010415e2f4b9c3351efdb61 Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Tue, 28 Apr 2026 11:15:02 +0200 Subject: [PATCH] Use ENV var SUPERVISOR_TOKEN as fallback for password --- README.md | 1 + src/lib/hass.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b21cc8..af1accc 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista ## Changelog ### **WORK IN PROGRESS** * (@klein0r) Use /core/ instead of /api/ when connecting to supervisor directly (e.g. in ha app) +* (@klein0r) Use ENV var SUPERVISOR_TOKEN as fallback for password ### 2.0.3 (2026-04-02) * (@GermanBluefox) Adapter was updated and migrated to TypeScript diff --git a/src/lib/hass.ts b/src/lib/hass.ts index b2231e8..7d949ff 100644 --- a/src/lib/hass.ts +++ b/src/lib/hass.ts @@ -108,11 +108,12 @@ export default class HASS extends EventEmitter { this.emit('state_changed', response.event.data.new_state); } } else if (response.type === 'auth_required') { - if (!this.options.password) { + const password = this.options.password || process.env.SUPERVISOR_TOKEN; + if (!password) { this.emit('error', 'Password required. Connection closed'); socket.terminate(); } else { - setTimeout(() => this.sendAuth(socket, this.options.password!), 50); + setTimeout(() => this.sendAuth(socket, password), 50); } } else if (response.type === 'auth_ok') { setImmediate(() =>