hass-taste-test 0.2.1 → 0.2.2

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,6 +25,7 @@ export declare class HomeAssistant<E> {
25
25
  private accessToken;
26
26
  private options;
27
27
  private dashboards;
28
+ private entitiesCollection;
28
29
  ws: hass.Connection;
29
30
  private constructor();
30
31
  private path_confFile;
@@ -81,6 +82,7 @@ export declare class HomeAssistant<E> {
81
82
  link(): Promise<string>;
82
83
  openInBrowser(): Promise<void>;
83
84
  }>;
85
+ states(): Promise<hass.HassEntities>;
84
86
  /** Clean up connections and stop the HomeAssistant server */
85
87
  close(): Promise<void>;
86
88
  HassDashboard: {
package/lib/index.js CHANGED
@@ -36,6 +36,7 @@ const net = __importStar(require("net"));
36
36
  const hass = __importStar(require("home-assistant-js-websocket"));
37
37
  const socket_1 = require("./socket");
38
38
  const proper_lockfile_1 = __importDefault(require("proper-lockfile"));
39
+ const home_assistant_js_websocket_1 = require("home-assistant-js-websocket");
39
40
  var playwright_1 = require("./integrations/playwright");
40
41
  Object.defineProperty(exports, "PlaywrightBrowser", { enumerable: true, get: function () { return playwright_1.PlaywrightBrowser; } });
41
42
  /** Sleeps for 100 ms */
@@ -55,6 +56,7 @@ class HomeAssistant {
55
56
  accessToken;
56
57
  options;
57
58
  dashboards = 0;
59
+ entitiesCollection;
58
60
  ws;
59
61
  constructor(options) {
60
62
  this.venvDir = (0, path_1.join)((0, os_1.tmpdir)(), 'hasstest-venv');
@@ -184,7 +186,7 @@ class HomeAssistant {
184
186
  const installed = await this.hassVersion();
185
187
  if (!installed || installed !== this.cache.latestHass) {
186
188
  await exec(this.path_pip(), ['install', '--upgrade', 'wheel']);
187
- await exec(this.path_pip(), ['install', '--upgrade', 'homeassistant']);
189
+ await exec(this.path_pip(), ['install', '--upgrade', 'mutagen', 'homeassistant']);
188
190
  }
189
191
  }
190
192
  async readCache() {
@@ -319,6 +321,8 @@ class HomeAssistant {
319
321
  auth,
320
322
  createSocket: async () => (0, socket_1.createSocket)(auth, false),
321
323
  });
324
+ console.log('VERSION IS', this.ws.haVersion);
325
+ this.entitiesCollection = (0, home_assistant_js_websocket_1.entitiesColl)(this.ws);
322
326
  }
323
327
  async addIntegration(name) {
324
328
  const response = await this.post('/api/config/config_entries/flow', {
@@ -382,6 +386,12 @@ class HomeAssistant {
382
386
  const page = await this.options.browser.open(this.customDashboard(dashboard, code), options || {});
383
387
  return new this.HassDashboard(this, dashboard, config, page);
384
388
  }
389
+ async states() {
390
+ console.log(this.entitiesCollection.state);
391
+ // this.entitiesCollection = entitiesColl(this.ws);
392
+ // await this.entitiesCollection.refresh();
393
+ return this.entitiesCollection.state;
394
+ }
385
395
  /** Clean up connections and stop the HomeAssistant server */
386
396
  async close() {
387
397
  if (this.options.browser)
package/lib/socket.js CHANGED
@@ -88,6 +88,7 @@ function createSocket(auth, ignoreCertificates) {
88
88
  socket.removeEventListener('message', handleMessage);
89
89
  socket.removeEventListener('close', closeMessage);
90
90
  socket.removeEventListener('error', errorMessage);
91
+ socket.haVersion = message.ha_version;
91
92
  promResolve(socket);
92
93
  break;
93
94
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hass-taste-test",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Integration testing for Home Assistant cards",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {