mirror of
https://github.com/xiaoshi930/xiaoshi-pad-card.git
synced 2025-11-28 16:49:42 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f58598f54 | ||
|
|
f71e51029c | ||
|
|
48f0c23456 | ||
|
|
910365f8b8 |
@@ -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,
|
||||
@@ -983,9 +997,9 @@ export class XiaoshiHaInfoCard extends LitElement {
|
||||
}
|
||||
|
||||
_handleConfirmUpdate(update, event) {
|
||||
this._handleClick();
|
||||
event.stopPropagation(); // 阻止事件冒泡
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
this._handleClick();
|
||||
|
||||
// 弹出确认对话框
|
||||
const confirmed = confirm(`确认要更新 ${update.name} 吗?\n当前版本: ${update.current_version}\n最新版本: ${update.latest_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)}>
|
||||
|
||||
@@ -523,6 +523,11 @@ export class XiaoshiUpdateCard extends LitElement {
|
||||
return; // 跳过此更新
|
||||
}
|
||||
}
|
||||
// 新增规则:如果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.', ''),
|
||||
@@ -588,9 +593,9 @@ export class XiaoshiUpdateCard extends LitElement {
|
||||
}
|
||||
|
||||
_handleConfirmUpdate(update, event) {
|
||||
this._handleClick();
|
||||
event.stopPropagation(); // 阻止事件冒泡
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
this._handleClick();
|
||||
|
||||
// 弹出确认对话框
|
||||
const confirmed = confirm(`确认要更新 ${update.name} 吗?\n当前版本: ${update.current_version}\n最新版本: ${update.latest_version}`);
|
||||
@@ -865,7 +870,7 @@ export class XiaoshiUpdateCard 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" @click=${(e) => this._handleConfirmUpdate(update, e)}>
|
||||
@@ -890,7 +895,7 @@ export class XiaoshiUpdateCard 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" @click=${(e) => this._handleConfirmUpdate(update, e)}>
|
||||
|
||||
Reference in New Issue
Block a user