test: close device presentation review findings

Issue: #267
User-Visible: no
This commit is contained in:
Matysh
2026-08-27 22:41:46 +03:00
parent 8b0ad08db2
commit 118062bb8c
10 changed files with 145 additions and 92 deletions
+2 -5
View File
@@ -27,7 +27,7 @@ export type PresentationReason =
| 'orphaned';
export type BindingPresentationLifecycle =
| 'active' | 'ha_disabled' | 'orphaned' | 'unverified';
| 'active' | 'ha_disabled' | 'orphaned';
export type PresentationFace = 'icon' | 'value';
export type ValueFallbackReason =
@@ -77,8 +77,7 @@ export function resolveDevicePresentationPolicy(
): DevicePresentationPolicyResult {
const decisions: string[] = [];
const bindingUnavailable = input.bindingLifecycle === 'ha_disabled'
|| input.bindingLifecycle === 'orphaned'
|| input.bindingLifecycle === 'unverified';
|| input.bindingLifecycle === 'orphaned';
let effectiveHidden = false;
if (input.bindingLifecycle === 'ha_disabled') {
@@ -91,8 +90,6 @@ export function resolveDevicePresentationPolicy(
decisions.push('lifecycle.user_hidden_preview');
} else if (input.bindingLifecycle === 'orphaned') {
decisions.push('lifecycle.orphaned_diagnostic');
} else if (input.bindingLifecycle === 'unverified') {
decisions.push('lifecycle.unverified_diagnostic');
} else {
decisions.push('lifecycle.active');
}
+1 -1
View File
@@ -585,7 +585,7 @@ export function resolveDevicePresentation(
const haDisabled = status?.kind === 'ha_disabled';
const orphaned = status?.kind === 'orphaned';
const lifecycle: BindingPresentationLifecycle = haDisabled ? 'ha_disabled'
: orphaned ? 'orphaned' : status?.kind === 'unverified' ? 'unverified' : 'active';
: orphaned ? 'orphaned' : 'active';
const userHidden = d.userHidden === true || d.marker?.hidden === true;
const combined = combineVisualSamples(sources.samples);
const lockSource = sources.visualSources.find((source) => source.eid.startsWith('lock.'));