mirror of
https://github.com/xiaoshi930/xiaoshi-pad-card.git
synced 2025-11-28 16:49:42 +00:00
Compare commits
6 Commits
f768186379
...
765b0a1367
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
765b0a1367 | ||
|
|
df66608d7f | ||
|
|
6ed3bca2cc | ||
|
|
f1d0b52bd7 | ||
|
|
528eaf1cd1 | ||
|
|
59268a91f8 |
17
README.md
17
README.md
@@ -24,19 +24,12 @@ max: 80 # 当前地区最大值
|
||||
mode: 湿度 # 【温度】或者【湿度】
|
||||
~~~
|
||||
|
||||
## 功能2:HA版本更新卡(手机平板端通用)
|
||||
## 功能2:HA信息卡(手机平板端通用)
|
||||
**引用示例**
|
||||
~~~
|
||||
type: custom:xiaoshi-update-card
|
||||
width: 100%
|
||||
theme: on
|
||||
~~~
|
||||
|
||||
## 功能3:HA离线设备卡(手机平板端通用)
|
||||
**引用示例**
|
||||
~~~
|
||||
type: custom:xiaoshi-offline-card
|
||||
width: 100%
|
||||
skip_updates: false #是否包含已跳过的更新
|
||||
theme: on
|
||||
exclude_devices:
|
||||
- *设备*
|
||||
@@ -44,7 +37,7 @@ exclude_entities:
|
||||
- *shiti*
|
||||
~~~
|
||||
|
||||
## 功能4:电话信息余额卡(手机平板端通用)
|
||||
## 功能3:电话信息余额卡(手机平板端通用)
|
||||
**引用示例**
|
||||
~~~
|
||||
type: custom:xiaoshi-balance-card
|
||||
@@ -68,7 +61,7 @@ entities:
|
||||
warning: "99"
|
||||
~~~
|
||||
|
||||
## 功能5:待办事项卡(手机平板端通用)
|
||||
## 功能4:待办事项卡(手机平板端通用)
|
||||
**引用示例**
|
||||
~~~
|
||||
type: custom:xiaoshi-todo-card
|
||||
@@ -79,7 +72,7 @@ entities:
|
||||
- todo.ji_shi_ben
|
||||
~~~
|
||||
|
||||
## 功能6:耗材信息卡片(手机平板端通用)
|
||||
## 功能5:耗材信息卡片(手机平板端通用)
|
||||
**引用示例**
|
||||
~~~
|
||||
type: custom:xiaoshi-consumables-card
|
||||
|
||||
1569
xiaoshi-device-consumables-button.js
Normal file
1569
xiaoshi-device-consumables-button.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -74,7 +74,6 @@ class XiaoshiConsumablesCardEditor extends LitElement {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
@@ -452,6 +451,8 @@ class XiaoshiConsumablesCardEditor extends LitElement {
|
||||
}
|
||||
|
||||
_entityChanged(e) {
|
||||
|
||||
|
||||
const { name, value } = e.target;
|
||||
if (!value && name !== 'theme' && name !== 'width' ) return;
|
||||
|
||||
@@ -1265,11 +1266,21 @@ class XiaoshiConsumablesCard extends LitElement {
|
||||
const warningCount = this._oilPriceData.filter(consumablesData => {
|
||||
let isWarning = false;
|
||||
|
||||
if (consumablesData.warning_threshold && consumablesData.warning_threshold.trim() !== '') {
|
||||
isWarning = this._evaluateWarningCondition(consumablesData.value, consumablesData.warning_threshold);
|
||||
// 对于 binary_sensor 和 event,使用默认预警逻辑
|
||||
if (consumablesData.entity_id.startsWith('binary_sensor.') && !consumablesData.warning_threshold) {
|
||||
// binary_sensor: "缺少"状态时预警
|
||||
isWarning = consumablesData.value === '缺少';
|
||||
} else if (consumablesData.entity_id.startsWith('event.') && !consumablesData.warning_threshold) {
|
||||
// event: "低电量"状态时预警
|
||||
isWarning = consumablesData.value === '低电量';
|
||||
} else {
|
||||
if (this.config.global_warning && this.config.global_warning.trim() !== '') {
|
||||
isWarning = this._evaluateWarningCondition(consumablesData.value, this.config.global_warning);
|
||||
// 使用配置的预警条件
|
||||
if (consumablesData.warning_threshold && consumablesData.warning_threshold.trim() !== '') {
|
||||
isWarning = this._evaluateWarningCondition(consumablesData.value, consumablesData.warning_threshold);
|
||||
} else {
|
||||
if (this.config.global_warning && this.config.global_warning.trim() !== '') {
|
||||
isWarning = this._evaluateWarningCondition(consumablesData.value, this.config.global_warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1388
xiaoshi-device-ha-info-card.js
Normal file
1388
xiaoshi-device-ha-info-card.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
console.info("%c 消逝卡-平板端 \n%c v 0.1.2 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
|
||||
console.info("%c 消逝卡-平板端 \n%c v 0.1.3 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
|
||||
|
||||
const loadCards = async () => {
|
||||
await import('./xiaoshi-pad-grid-card.js');
|
||||
await import('./xiaoshi-device-update-card.js');
|
||||
await import('./xiaoshi-device-offline-card.js');
|
||||
await import('./xiaoshi-device-balance-card.js');
|
||||
await import('./xiaoshi-device-todo-card.js');
|
||||
await import('./xiaoshi-device-consumables-card.js');
|
||||
await import('./xiaoshi-device-consumables-button.js');
|
||||
await import('./xiaoshi-device-ha-info-card.js');
|
||||
await import('./xiaoshi-device-update-card.js');
|
||||
await import('./xiaoshi-device-offline-card.js');
|
||||
|
||||
window.customCards = window.customCards || [];
|
||||
window.customCards.push(...cardConfigs);
|
||||
@@ -19,15 +21,9 @@ const cardConfigs = [
|
||||
description: '温度分布、湿度分布'
|
||||
},
|
||||
{
|
||||
type: 'xiaoshi-update-card',
|
||||
name: '消逝卡HA更新监控卡片',
|
||||
description: '显示需要更新的组件和版本',
|
||||
preview: true
|
||||
},
|
||||
{
|
||||
type: 'xiaoshi-offline-card',
|
||||
name: '消逝卡HA离线设备卡片',
|
||||
description: '显示所有离线的设备和实体',
|
||||
type: 'xiaoshi-ha-info-card',
|
||||
name: '消逝卡HA信息卡片',
|
||||
description: '消逝卡HA信息卡片',
|
||||
preview: true
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user