Merge pull request #166 from klein0r/master
Use /core/ instead of /api/ when connecting to supervisor directly
This commit is contained in:
@@ -9,3 +9,7 @@ package-lock.json
|
|||||||
.commitinfo
|
.commitinfo
|
||||||
.claude/settings.local.json
|
.claude/settings.local.json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ioBroker dev-server
|
||||||
|
.dev-server/
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
## Changelog
|
## 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.4 (2026-05-05)
|
### 2.0.4 (2026-05-05)
|
||||||
* (@GermanBluefox) Tried to keep the custom settings of the objects when updating them with new data from HASS
|
* (@GermanBluefox) Tried to keep the custom settings of the objects when updating them with new data from HASS
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 9.6 KiB |
+4
-3
@@ -108,11 +108,12 @@ export default class HASS extends EventEmitter {
|
|||||||
this.emit('state_changed', response.event.data.new_state);
|
this.emit('state_changed', response.event.data.new_state);
|
||||||
}
|
}
|
||||||
} else if (response.type === 'auth_required') {
|
} 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');
|
this.emit('error', 'Password required. Connection closed');
|
||||||
socket.terminate();
|
socket.terminate();
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => this.sendAuth(socket, this.options.password!), 50);
|
setTimeout(() => this.sendAuth(socket, password), 50);
|
||||||
}
|
}
|
||||||
} else if (response.type === 'auth_ok') {
|
} else if (response.type === 'auth_ok') {
|
||||||
setImmediate(() =>
|
setImmediate(() =>
|
||||||
@@ -228,7 +229,7 @@ export default class HASS extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.socket = new WebSocket(
|
this.socket = new WebSocket(
|
||||||
`ws${this.options.secure ? 's' : ''}://${this.options.host}:${this.options.port}/api/websocket`,
|
`ws${this.options.secure ? 's' : ''}://${this.options.host}:${this.options.port}/${this.options.host === 'supervisor' ? 'core' : 'api'}/websocket`,
|
||||||
{ perMessageDeflate: false },
|
{ perMessageDeflate: false },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user