Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(home-scene): select a device through its room, the way the keyboard route works

nirholasd924e183451b
diff --git a/scripts/measure-home-scene.mjs b/scripts/measure-home-scene.mjs
index 4582ef508..e243b5114 100644
--- a/scripts/measure-home-scene.mjs
+++ b/scripts/measure-home-scene.mjs
@@ -591,13 +591,30 @@ async function clickEntity(page, entityId) {
// person cannot reach, because the room rail lists every one of them and is
// the keyboard route to the same selection. Falling back to it keeps the
// measurement about the product rather than about pointer luck.
- const row = page.locator(`.hs-room-device[data-entity-id="${entityId.replace(/"/g, '\\"')}"]`).first();
+ //
+ // The rail lists devices for the room it is focused on, so the room comes
+ // first, exactly as a person using the keyboard would do it.
+ const roomId = await page.evaluate(
+ (id) => window.__homeScene.model.rooms.find((room) => room.objects.some((o) => o.entityId === id))?.id || null,
+ entityId,
+ );
+ if (!roomId) return false;
+ const room = page.locator(`.hs-room[data-room-id="${cssValue(roomId)}"]`).first();
+ if (!(await room.count())) return false;
+ await room.click();
+ const row = page.locator(`.hs-room-device[data-entity-id="${cssValue(entityId)}"]`).first();
+ await row.waitFor({ timeout: 10_000 }).catch(() => {});
if (!(await row.count())) return false;
await row.scrollIntoViewIfNeeded().catch(() => {});
await row.click();
return selected();
}
+/** Quote a Home Assistant id for a CSS attribute selector. */
+function cssValue(value) {
+ return String(value).replace(/["\\]/g, '\\$&');
+}
+
/** Every drawn object of a domain, room by room. */
async function objectsOfDomain(page, domain) {
return page.evaluate(