Update xiaoshi-device-ha-info-card.js

This commit is contained in:
xiaoshi
2025-11-29 00:05:21 +08:00
committed by GitHub
parent 48f0c23456
commit f71e51029c

View File

@@ -766,6 +766,14 @@ export class XiaoshiHaInfoCard extends LitElement {
if (entityId.startsWith('climate.')) return 'mdi:thermostat';
if (entityId.startsWith('cover.')) return 'mdi:window-shutter';
if (entityId.startsWith('weather.')) return 'mdi:weather-cloudy';
if (entityId.startsWith('input_select.')) return 'mdi:form-select';
if (entityId.startsWith('select.')) return 'mdi:form-select';
if (entityId.startsWith('input_text.')) return 'mdi:form-textbox';
if (entityId.startsWith('text.')) return 'mdi:form-textbox';
if (entityId.startsWith('button.')) return 'mdi:button-pointer';
if (entityId.startsWith('event.')) return 'mdi:gesture-tap-button';
if (entityId.startsWith('device_tracker.')) return 'mdi:lan-connect';
if (entityId.startsWith('notify.')) return 'mdi:message';
return 'mdi:help-circle';
}
@@ -918,6 +926,12 @@ export class XiaoshiHaInfoCard extends LitElement {
}
}
// 新增规则如果skipped_version为null情况下当latest_version !== installed_version时
// 且实体状态为off时有可能是安装的版本比latest_version还高这种不算更新的实体
if (attributes.skipped_version === null && entity.state === 'off') {
return; // 跳过此更新
}
const updateData = {
name: attributes.friendly_name || entity.entity_id.replace('update.', ''),
current_version: attributes.installed_version,
@@ -1261,7 +1275,7 @@ export class XiaoshiHaInfoCard extends LitElement {
<div class="device-name">${update.name}</div>
<div class="device-details">
当前版本: ${update.current_version} → 最新版本: ${update.latest_version}
${update.skipped_version ? html`<span style="color: #ff9800;"> 已跳过版本: ${update.skipped_version}</span>` : ''}
${update.skipped_version ? html`<br><span style="color: #ff9800;">已跳过版本: ${update.skipped_version}</span>` : ''}
</div>
</div>
<div class="device-last-seen-update" @click=${(e) => this._handleConfirmUpdate(update, e)}>
@@ -1286,7 +1300,7 @@ export class XiaoshiHaInfoCard extends LitElement {
<div class="device-name">${update.name}</div>
<div class="device-details">
当前版本: ${update.current_version} → 最新版本: ${update.latest_version}
${update.skipped_version ? html`<span style="color: #ff9800;"> 已跳过版本: ${update.skipped_version}</span>` : ''}
${update.skipped_version ? html`<br><span style="color: #ff9800;">已跳过版本: ${update.skipped_version}</span>` : ''}
</div>
</div>
<div class="device-last-seen-update" @click=${(e) => this._handleConfirmUpdate(update, e)}>