hass-taste-test 0.2.2 → 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 CHANGED
@@ -25,7 +25,7 @@ export declare class HomeAssistant<E> {
25
25
  private accessToken;
26
26
  private options;
27
27
  private dashboards;
28
- private entitiesCollection;
28
+ private entities;
29
29
  ws: hass.Connection;
30
30
  private constructor();
31
31
  private path_confFile;
package/lib/index.js CHANGED
@@ -56,7 +56,7 @@ class HomeAssistant {
56
56
  accessToken;
57
57
  options;
58
58
  dashboards = 0;
59
- entitiesCollection;
59
+ entities = {};
60
60
  ws;
61
61
  constructor(options) {
62
62
  this.venvDir = (0, path_1.join)((0, os_1.tmpdir)(), 'hasstest-venv');
@@ -321,14 +321,15 @@ class HomeAssistant {
321
321
  auth,
322
322
  createSocket: async () => (0, socket_1.createSocket)(auth, false),
323
323
  });
324
- console.log('VERSION IS', this.ws.haVersion);
325
- this.entitiesCollection = (0, home_assistant_js_websocket_1.entitiesColl)(this.ws);
324
+ (0, home_assistant_js_websocket_1.subscribeEntities)(this.ws, (e) => (this.entities = { ...this.entities, ...e }));
326
325
  }
327
326
  async addIntegration(name) {
328
327
  const response = await this.post('/api/config/config_entries/flow', {
329
328
  handler: name,
330
329
  show_advanced_options: false,
331
330
  }, true);
331
+ if (response.message)
332
+ throw new Error(`Error configuring ${name} integration. Check the logs: ${response.message}`);
332
333
  if (!response.result)
333
334
  throw new Error('Multi-step integration flows are not yet suppoted');
334
335
  return response.result;
@@ -387,10 +388,7 @@ class HomeAssistant {
387
388
  return new this.HassDashboard(this, dashboard, config, page);
388
389
  }
389
390
  async states() {
390
- console.log(this.entitiesCollection.state);
391
- // this.entitiesCollection = entitiesColl(this.ws);
392
- // await this.entitiesCollection.refresh();
393
- return this.entitiesCollection.state;
391
+ return this.entities;
394
392
  }
395
393
  /** Clean up connections and stop the HomeAssistant server */
396
394
  async close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hass-taste-test",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Integration testing for Home Assistant cards",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -15,27 +15,27 @@
15
15
  "homepage": "https://github.com/rianadon/hass-taste-test#readme",
16
16
  "license": "AGPL-3.0-or-later",
17
17
  "dependencies": {
18
- "home-assistant-js-websocket": "^8.0.1",
19
- "node-fetch": "^2.6.1",
18
+ "home-assistant-js-websocket": "^8.2.0",
19
+ "node-fetch": "^2.6.4",
20
20
  "proper-lockfile": "^4.1.2",
21
- "ws": "^8.11.0"
21
+ "ws": "^8.13.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/jest": "^29.2.4",
24
+ "@types/jest": "^29.5.3",
25
25
  "@types/jest-image-snapshot": "^6.1.0",
26
- "@types/node-fetch": "^2.6.2",
26
+ "@types/node-fetch": "^2.6.4",
27
27
  "@types/proper-lockfile": "^4.1.2",
28
- "@types/ws": "^8.5.3",
29
- "ava": "^5.1.0",
30
- "husky": "^8.0.2",
31
- "jest": "^29.3.1",
28
+ "@types/ws": "^8.5.5",
29
+ "ava": "^5.3.1",
30
+ "husky": "^8.0.3",
31
+ "jest": "^29.6.1",
32
32
  "jest-image-snapshot": "^6.1.0",
33
- "lint-staged": "^13.1.0",
34
- "playwright": "^1.29.0",
35
- "prettier": "^2.8.1",
36
- "ts-jest": "^29.0.3",
33
+ "lint-staged": "^13.2.3",
34
+ "playwright": "^1.36.1",
35
+ "prettier": "^3.0.0",
36
+ "ts-jest": "^29.1.1",
37
37
  "ts-node": "^10.9.1",
38
- "typescript": "^4.9.4"
38
+ "typescript": "^5.1.6"
39
39
  },
40
40
  "prettier": {
41
41
  "printWidth": 100,