hass-taste-test 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +5 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -56,7 +56,7 @@ class HomeAssistant {
|
|
|
56
56
|
accessToken;
|
|
57
57
|
options;
|
|
58
58
|
dashboards = 0;
|
|
59
|
-
|
|
59
|
+
entities = {};
|
|
60
60
|
ws;
|
|
61
61
|
constructor(options) {
|
|
62
62
|
this.venvDir = (0, path_1.join)((0, os_1.tmpdir)(), 'hasstest-venv');
|
|
@@ -321,13 +321,15 @@ class HomeAssistant {
|
|
|
321
321
|
auth,
|
|
322
322
|
createSocket: async () => (0, socket_1.createSocket)(auth, false),
|
|
323
323
|
});
|
|
324
|
-
|
|
324
|
+
(0, home_assistant_js_websocket_1.subscribeEntities)(this.ws, (e) => (this.entities = { ...this.entities, ...e }));
|
|
325
325
|
}
|
|
326
326
|
async addIntegration(name) {
|
|
327
327
|
const response = await this.post('/api/config/config_entries/flow', {
|
|
328
328
|
handler: name,
|
|
329
329
|
show_advanced_options: false,
|
|
330
330
|
}, true);
|
|
331
|
+
if (response.message)
|
|
332
|
+
throw new Error(`Error configuring ${name} integration. Check the logs: ${response.message}`);
|
|
331
333
|
if (!response.result)
|
|
332
334
|
throw new Error('Multi-step integration flows are not yet suppoted');
|
|
333
335
|
return response.result;
|
|
@@ -386,10 +388,7 @@ class HomeAssistant {
|
|
|
386
388
|
return new this.HassDashboard(this, dashboard, config, page);
|
|
387
389
|
}
|
|
388
390
|
async states() {
|
|
389
|
-
|
|
390
|
-
// this.entitiesCollection = entitiesColl(this.ws);
|
|
391
|
-
await this.entitiesCollection.refresh();
|
|
392
|
-
return this.entitiesCollection.state;
|
|
391
|
+
return this.entities;
|
|
393
392
|
}
|
|
394
393
|
/** Clean up connections and stop the HomeAssistant server */
|
|
395
394
|
async close() {
|