diff --git a/demo/smoke_climate_once.mjs b/demo/smoke_climate_once.mjs index 02b012c2..0f62defd 100644 --- a/demo/smoke_climate_once.mjs +++ b/demo/smoke_climate_once.mjs @@ -62,13 +62,14 @@ const res = await page.evaluate(async () => { return out; }); // зафиксировано прогоном на v1.45.0 и сверено с кодом. -// scansPerUpdate = 2: один обход у areaClimateMap, один у buildDevices. Важно +// scansPerUpdate = 1: active-registry projection is shared by the climate map +// and buildDevices. Важно // не само число, а что оно не растёт вместе с числом комнат. checkAll(res, { scansOnRerender: 0, roomCount: 44, scansSameWith44Rooms: true, - scansPerUpdate: 2, + scansPerUpdate: 1, tempBefore: 22.4, tempAfter: 33.3, climateIsMap: true, diff --git a/demo/smoke_cover_no_plate.mjs b/demo/smoke_cover_no_plate.mjs index 2ae0533e..b5c73178 100644 --- a/demo/smoke_cover_no_plate.mjs +++ b/demo/smoke_cover_no_plate.mjs @@ -181,7 +181,15 @@ const out = await page.evaluate(async () => { const valve = { id: 'v', primary: 'valve.water', entities: ['valve.water'], marker: null }; const clsOfState = (d, states) => { const saved = c.hass; - c.hass = { ...c.hass, states: { ...c.hass.states, ...states } }; + const entities = Object.fromEntries(Object.keys(states).map((entity_id) => [ + entity_id, + { entity_id, platform: 'demo', disabled_by: null }, + ])); + c.hass = { + ...c.hass, + entities: { ...c.hass.entities, ...entities }, + states: { ...c.hass.states, ...states }, + }; const r = c._stateClass(d); c.hass = saved; return r; diff --git a/demo/smoke_cover_plate_precedence.mjs b/demo/smoke_cover_plate_precedence.mjs index 045ab93b..18a55cb5 100644 --- a/demo/smoke_cover_plate_precedence.mjs +++ b/demo/smoke_cover_plate_precedence.mjs @@ -45,7 +45,15 @@ const out = await page.evaluate(async () => { // ======================================================================= const withStates = (states, fn) => { const saved = c.hass; - c.hass = { ...c.hass, states: { ...c.hass.states, ...states } }; + const entities = Object.fromEntries(Object.keys(states).map((entity_id) => [ + entity_id, + { entity_id, platform: 'demo', disabled_by: null }, + ])); + c.hass = { + ...c.hass, + entities: { ...c.hass.entities, ...entities }, + states: { ...c.hass.states, ...states }, + }; const r = fn(); c.hass = saved; return r; diff --git a/demo/smoke_tap_run.mjs b/demo/smoke_tap_run.mjs index d63fa25f..2bea4266 100644 --- a/demo/smoke_tap_run.mjs +++ b/demo/smoke_tap_run.mjs @@ -8,6 +8,10 @@ const out = await page.evaluate(async () => { const sr = () => c.shadowRoot || c.renderRoot; const calls = []; c.hass = { ...c.hass, + entities: { ...c.hass.entities, + 'automation.evening': { entity_id: 'automation.evening', platform: 'automation', disabled_by: null }, + 'script.curtains': { entity_id: 'script.curtains', platform: 'script', disabled_by: null }, + 'scene.movie': { entity_id: 'scene.movie', platform: 'scene', disabled_by: null } }, states: { ...c.hass.states, 'automation.evening': { state: 'on', attributes: { friendly_name: 'Вечерний свет' } }, 'script.curtains': { state: 'off', attributes: { friendly_name: 'Шторы' } }, diff --git a/demo/smoke_vacuum.mjs b/demo/smoke_vacuum.mjs index b61e353d..d8647b80 100644 --- a/demo/smoke_vacuum.mjs +++ b/demo/smoke_vacuum.mjs @@ -11,7 +11,11 @@ const out = await page.evaluate(async () => { // via the 6-number matrix directly (0.5 scale: robot 0..2000 -> canvas 0..1000) const M = [0.5, 0, 0, 0, 0.5, 0]; const mkAttrs = (x, y, extra) => ({ vacuum_position: { x, y, a: 45 }, map_name: 'm1', ...extra }); - c.hass = { ...c.hass, states: { ...c.hass.states, + c.hass = { ...c.hass, + entities: { ...c.hass.entities, + 'vacuum.robo': { entity_id: 'vacuum.robo', platform: 'demo', disabled_by: null }, + 'camera.robo_map': { entity_id: 'camera.robo_map', platform: 'demo', disabled_by: null } }, + states: { ...c.hass.states, 'vacuum.robo': { state: 'docked', attributes: { friendly_name: 'Робот' } }, 'camera.robo_map': { state: 'idle', attributes: mkAttrs(600, 800) }, } }; diff --git a/demo/smoke_vacuum_firstuse.mjs b/demo/smoke_vacuum_firstuse.mjs index fd564033..f8e52b00 100644 --- a/demo/smoke_vacuum_firstuse.mjs +++ b/demo/smoke_vacuum_firstuse.mjs @@ -64,7 +64,7 @@ const out = await page.evaluate(async () => { // ---- manual fit from scratch (HP-1540-01) ---- cfg.markers = []; - c._regSignature = ''; c.requestUpdate(); await c.updateComplete; + c._regSignature = ''; c._maybeRebuildDevices(); c.requestUpdate(); await c.updateComplete; const dev2 = c._devices.find((x) => x.id === 'd_mower'); o.fitFreshNoMarker = !dev2.marker; c._vacStartFit(dev2); await c.updateComplete; @@ -76,7 +76,7 @@ const out = await page.evaluate(async () => { // ---- live checkbox + trail select from scratch (HP-1540-01) ---- cfg.markers = []; - c._regSignature = ''; c.requestUpdate(); await c.updateComplete; + c._regSignature = ''; c._maybeRebuildDevices(); c.requestUpdate(); await c.updateComplete; c._setMode('devices'); await c.updateComplete; c._openMarkerDialog(c._devices.find((x) => x.id === 'd_mower')); await c.updateComplete; const liveBox = sr().querySelector('.vacbox input[type=checkbox]'); diff --git a/demo/smoke_yellow_principle.mjs b/demo/smoke_yellow_principle.mjs index 83acbaaa..7eb41e10 100644 --- a/demo/smoke_yellow_principle.mjs +++ b/demo/smoke_yellow_principle.mjs @@ -9,7 +9,15 @@ const out = await page.evaluate(() => { const c = window.__card; const cls = (d, states) => { const saved = c.hass; - c.hass = { ...c.hass, states: { ...c.hass.states, ...states } }; + const entities = Object.fromEntries(Object.keys(states).map((entity_id) => [ + entity_id, + { entity_id, platform: 'demo', disabled_by: null }, + ])); + c.hass = { + ...c.hass, + entities: { ...c.hass.entities, ...entities }, + states: { ...c.hass.states, ...states }, + }; const r = c._stateClass(d); c.hass = saved; return r;