hass-taste-test 0.2.1 → 0.2.3
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 +2 -0
- package/lib/index.js +10 -1
- package/lib/socket.js +1 -0
- package/package.json +15 -15
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,7 @@ class HomeAssistant {
|
|
|
319
321
|
auth,
|
|
320
322
|
createSocket: async () => (0, socket_1.createSocket)(auth, false),
|
|
321
323
|
});
|
|
324
|
+
this.entitiesCollection = (0, home_assistant_js_websocket_1.entitiesColl)(this.ws);
|
|
322
325
|
}
|
|
323
326
|
async addIntegration(name) {
|
|
324
327
|
const response = await this.post('/api/config/config_entries/flow', {
|
|
@@ -382,6 +385,12 @@ class HomeAssistant {
|
|
|
382
385
|
const page = await this.options.browser.open(this.customDashboard(dashboard, code), options || {});
|
|
383
386
|
return new this.HassDashboard(this, dashboard, config, page);
|
|
384
387
|
}
|
|
388
|
+
async states() {
|
|
389
|
+
console.log(this.entitiesCollection.state);
|
|
390
|
+
// this.entitiesCollection = entitiesColl(this.ws);
|
|
391
|
+
await this.entitiesCollection.refresh();
|
|
392
|
+
return this.entitiesCollection.state;
|
|
393
|
+
}
|
|
385
394
|
/** Clean up connections and stop the HomeAssistant server */
|
|
386
395
|
async close() {
|
|
387
396
|
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.
|
|
3
|
+
"version": "0.2.3",
|
|
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
|
|
19
|
-
"node-fetch": "^2.6.
|
|
18
|
+
"home-assistant-js-websocket": "^8.2.0",
|
|
19
|
+
"node-fetch": "^2.6.4",
|
|
20
20
|
"proper-lockfile": "^4.1.2",
|
|
21
|
-
"ws": "^8.
|
|
21
|
+
"ws": "^8.13.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/jest": "^29.
|
|
24
|
+
"@types/jest": "^29.5.3",
|
|
25
25
|
"@types/jest-image-snapshot": "^6.1.0",
|
|
26
|
-
"@types/node-fetch": "^2.6.
|
|
26
|
+
"@types/node-fetch": "^2.6.4",
|
|
27
27
|
"@types/proper-lockfile": "^4.1.2",
|
|
28
|
-
"@types/ws": "^8.5.
|
|
29
|
-
"ava": "^5.1
|
|
30
|
-
"husky": "^8.0.
|
|
31
|
-
"jest": "^29.
|
|
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.
|
|
34
|
-
"playwright": "^1.
|
|
35
|
-
"prettier": "^
|
|
36
|
-
"ts-jest": "^29.
|
|
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": "^
|
|
38
|
+
"typescript": "^5.1.6"
|
|
39
39
|
},
|
|
40
40
|
"prettier": {
|
|
41
41
|
"printWidth": 100,
|