Compare commits

...

8 Commits

Author SHA1 Message Date
xiaoshi
4aca5983e6 Update xiaoshi-pad-climate-card.js 2026-01-25 22:12:52 +08:00
xiaoshi
16e8cb8493 Update xiaoshi-pad-climate-card.js 2026-01-25 20:08:20 +08:00
xiaoshi
d0c11c3f08 Update xiaoshi-pad-climate-card.js 2026-01-25 20:01:09 +08:00
xiaoshi
1908ec0fae Update version number in console log 2026-01-25 19:50:50 +08:00
xiaoshi
98ec3bfd5e Update xiaoshi-pad-climate-card.js 2026-01-25 19:50:39 +08:00
xiaoshi
57d4627fa0 Update xiaoshi-pad-climate-card.js 2026-01-25 19:48:42 +08:00
xiaoshi
e12f60b284 Update xiaoshi-pad-card.js 2026-01-25 16:46:02 +08:00
xiaoshi
b12c5c633a Update xiaoshi-pad-climate-card.js 2026-01-25 16:45:51 +08:00
2 changed files with 15 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
console.info("%c 消逝卡-平板端 \n%c v 1.0.2 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
console.info("%c 消逝卡-平板端 \n%c v 1.0.4 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
const loadCards = () => {
import('./xiaoshi-pad-climate-card.js');

View File

@@ -1367,6 +1367,7 @@ class XiaoshiPadClimateCard extends LitElement {
background: rgb(0,0,0,0);
cursor: pointer;
padding: 0;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
@@ -1924,7 +1925,7 @@ _renderExtraButtons(buttonType = 1) {
const domain = buttonEntityId.split('.')[0];
const friendlyName = entity.attributes.friendly_name || '';
const displayName = friendlyName.slice(0, 4);
const displayValueColor = entity.state === '低' ? 'red' : fgColor;
const displayValueColor = entity.state.includes('低') || entity.state.includes('少') || entity.state.includes('缺') ? 'red' : fgColor;
// 根据名称自定义图标
const _getCustomIcon = (name, isActive) => {
@@ -1934,6 +1935,9 @@ _renderExtraButtons(buttonType = 1) {
if (name.includes('睡眠')) return isActive ? 'mdi:sleep' : 'mdi:sleep-off';
if (name.includes('指示灯')) return isActive ? 'mdi:lightbulb-on' : 'mdi:lightbulb-off';
if (name.includes('提示音')) return isActive ? 'mdi:volume-high' : 'mdi:volume-mute';
if (name.includes('防冻')) return isActive ? 'mdi:snowflake' : 'mdi:snowflake-off';
if (name.includes('防烫伤')) return isActive ? 'mdi:fire' : 'mdi:fire-off';
if (name.includes('按键锁')) return isActive ? 'mdi:lock-open' : 'mdi:lock-open-variant';
return null;
};
@@ -1963,8 +1967,8 @@ _renderExtraButtons(buttonType = 1) {
return html`
<div class="side-extra-button" style="cursor: default; --bg-color: ${bgColor};">
<div class="side-value" style="color: ${displayValueColor}; font-size: 12px;">${displayValue}</div>
<span class="side-text" style="color: ${buttonColor}">${displayName}</span>
<div class="side-value" style="color: ${displayValueColor}; font-size: 11px; font-weight: bold; white-space: nowrap">${displayValue}</div>
<span class="side-text" style="color: ${fgColor};">${displayName}</span>
</div>
`;
@@ -1974,23 +1978,22 @@ _renderExtraButtons(buttonType = 1) {
return html`
<button class="side-extra-button"
@click=${() => this._handleExtraButtonClick(buttonEntityId, domain)}
style="color: ${buttonColor}; --bg-color: ${bgColor};">
<ha-icon class="side-icon" icon="${buttonIcon}" style="color: ${buttonColor}"></ha-icon>
<span class="side-text" style="color: ${buttonColor}">${displayName}</span>
style="color: ${fgColor}; --bg-color: ${bgColor};">
<ha-icon class="side-icon" icon="${buttonIcon}" style="color: ${fgColor}"></ha-icon>
<span class="side-text" style="color: ${fgColor};">${displayName}</span>
</button>
`;
case 'select':
const options = entity.attributes.options || [];
const firstOption = options[0] || '';
const selectDisplayValue = firstOption.slice(0, 4);
const state = entity.state || '';
const selectDisplayValue = state.slice(0, 4);
return html`
<div class="side-extra-button"
@click=${() => this._handleExtraButtonClick(buttonEntityId, domain)}
style="cursor: default; --bg-color: ${bgColor};">
<div class="side-value" style="color: ${buttonColor}; font-size: 12px;">${selectDisplayValue}</div>
<span class="side-text" style="color: ${buttonColor}">${displayName}</span>
<div class="side-value" style="color: ${fgColor}; font-size: 11px; font-weight: bold; white-space: nowrap">${selectDisplayValue}</div>
<span class="side-text" style="color: ${fgColor};">${displayName}</span>
</div>
`;