mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
test: align smokes with active registry projection
This commit is contained in:
@@ -62,13 +62,14 @@ const res = await page.evaluate(async () => {
|
|||||||
return out;
|
return out;
|
||||||
});
|
});
|
||||||
// зафиксировано прогоном на v1.45.0 и сверено с кодом.
|
// зафиксировано прогоном на v1.45.0 и сверено с кодом.
|
||||||
// scansPerUpdate = 2: один обход у areaClimateMap, один у buildDevices. Важно
|
// scansPerUpdate = 1: active-registry projection is shared by the climate map
|
||||||
|
// and buildDevices. Важно
|
||||||
// не само число, а что оно не растёт вместе с числом комнат.
|
// не само число, а что оно не растёт вместе с числом комнат.
|
||||||
checkAll(res, {
|
checkAll(res, {
|
||||||
scansOnRerender: 0,
|
scansOnRerender: 0,
|
||||||
roomCount: 44,
|
roomCount: 44,
|
||||||
scansSameWith44Rooms: true,
|
scansSameWith44Rooms: true,
|
||||||
scansPerUpdate: 2,
|
scansPerUpdate: 1,
|
||||||
tempBefore: 22.4,
|
tempBefore: 22.4,
|
||||||
tempAfter: 33.3,
|
tempAfter: 33.3,
|
||||||
climateIsMap: true,
|
climateIsMap: true,
|
||||||
|
|||||||
@@ -181,7 +181,15 @@ const out = await page.evaluate(async () => {
|
|||||||
const valve = { id: 'v', primary: 'valve.water', entities: ['valve.water'], marker: null };
|
const valve = { id: 'v', primary: 'valve.water', entities: ['valve.water'], marker: null };
|
||||||
const clsOfState = (d, states) => {
|
const clsOfState = (d, states) => {
|
||||||
const saved = c.hass;
|
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);
|
const r = c._stateClass(d);
|
||||||
c.hass = saved;
|
c.hass = saved;
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -45,7 +45,15 @@ const out = await page.evaluate(async () => {
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
const withStates = (states, fn) => {
|
const withStates = (states, fn) => {
|
||||||
const saved = c.hass;
|
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();
|
const r = fn();
|
||||||
c.hass = saved;
|
c.hass = saved;
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ const out = await page.evaluate(async () => {
|
|||||||
const sr = () => c.shadowRoot || c.renderRoot;
|
const sr = () => c.shadowRoot || c.renderRoot;
|
||||||
const calls = [];
|
const calls = [];
|
||||||
c.hass = { ...c.hass,
|
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,
|
states: { ...c.hass.states,
|
||||||
'automation.evening': { state: 'on', attributes: { friendly_name: 'Вечерний свет' } },
|
'automation.evening': { state: 'on', attributes: { friendly_name: 'Вечерний свет' } },
|
||||||
'script.curtains': { state: 'off', attributes: { friendly_name: 'Шторы' } },
|
'script.curtains': { state: 'off', attributes: { friendly_name: 'Шторы' } },
|
||||||
|
|||||||
@@ -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)
|
// 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 M = [0.5, 0, 0, 0, 0.5, 0];
|
||||||
const mkAttrs = (x, y, extra) => ({ vacuum_position: { x, y, a: 45 }, map_name: 'm1', ...extra });
|
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: 'Робот' } },
|
'vacuum.robo': { state: 'docked', attributes: { friendly_name: 'Робот' } },
|
||||||
'camera.robo_map': { state: 'idle', attributes: mkAttrs(600, 800) },
|
'camera.robo_map': { state: 'idle', attributes: mkAttrs(600, 800) },
|
||||||
} };
|
} };
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const out = await page.evaluate(async () => {
|
|||||||
|
|
||||||
// ---- manual fit from scratch (HP-1540-01) ----
|
// ---- manual fit from scratch (HP-1540-01) ----
|
||||||
cfg.markers = [];
|
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');
|
const dev2 = c._devices.find((x) => x.id === 'd_mower');
|
||||||
o.fitFreshNoMarker = !dev2.marker;
|
o.fitFreshNoMarker = !dev2.marker;
|
||||||
c._vacStartFit(dev2); await c.updateComplete;
|
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) ----
|
// ---- live checkbox + trail select from scratch (HP-1540-01) ----
|
||||||
cfg.markers = [];
|
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._setMode('devices'); await c.updateComplete;
|
||||||
c._openMarkerDialog(c._devices.find((x) => x.id === 'd_mower')); await c.updateComplete;
|
c._openMarkerDialog(c._devices.find((x) => x.id === 'd_mower')); await c.updateComplete;
|
||||||
const liveBox = sr().querySelector('.vacbox input[type=checkbox]');
|
const liveBox = sr().querySelector('.vacbox input[type=checkbox]');
|
||||||
|
|||||||
@@ -9,7 +9,15 @@ const out = await page.evaluate(() => {
|
|||||||
const c = window.__card;
|
const c = window.__card;
|
||||||
const cls = (d, states) => {
|
const cls = (d, states) => {
|
||||||
const saved = c.hass;
|
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);
|
const r = c._stateClass(d);
|
||||||
c.hass = saved;
|
c.hass = saved;
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user