Compare commits

...

3 Commits

Author SHA1 Message Date
xiaoshi
49e3ce2b0d Update xiaoshi-pad-climate-card.js 2026-01-25 16:39:28 +08:00
xiaoshi
366d9625bb Update xiaoshi-pad-climate-card.js 2026-01-25 16:36:00 +08:00
xiaoshi
db7c3c7b34 Update xiaoshi-pad-card.js 2026-01-25 16:35:48 +08:00
2 changed files with 7 additions and 70 deletions

View File

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

View File

@@ -681,49 +681,6 @@ class XiaoshiPadClimateCardEditor extends LitElement {
<option value="off">深色主题(深灰底白字)</option>
</select>
</div>
<!-- 温度传感器 -->
<div class="form-group">
<label>温度传感器 (可选)</label>
<div class="entity-selector-with-remove">
<div class="entity-selector">
<input
type="text"
@input=${this._onTemperatureSearch}
@focus=${this._onTemperatureSearch}
.value=${this._temperatureSearchTerm || this.config.temperature || ''}
placeholder="搜索传感器..."
class="entity-search-input"
/>
${this._showTemperatureList ? html`
<div class="entity-dropdown">
${this._filteredTemperatureEntities.map(entity => html`
<div
class="entity-option ${this.config.temperature === entity.entity_id ? 'selected' : ''}"
@click=${() => this._selectTemperature(entity.entity_id)}
>
<div class="entity-info">
<ha-icon icon="${entity.attributes.icon || 'mdi:help-circle'}"></ha-icon>
<div class="entity-details">
<div class="entity-name">${entity.attributes.friendly_name || entity.entity_id}</div>
<div class="entity-id">${entity.entity_id}</div>
</div>
</div>
${this.config.temperature === entity.entity_id ?
html`<ha-icon icon="mdi:check" class="check-icon"></ha-icon>` : ''}
</div>
`)}
${this._filteredTemperatureEntities.length === 0 ? html`
<div class="no-results">未找到匹配的实体</div>
` : ''}
</div>
` : ''}
</div>
<button class="remove-button" @click=${this._removeTemperature} title="移除温度传感器">
<ha-icon icon="mdi:close"></ha-icon>
</button>
</div>
</div>
<!-- 定时器位置 -->
${this.config.timer ? html`
@@ -933,32 +890,15 @@ class XiaoshiPadClimateCardEditor extends LitElement {
<!-- 宽度设置 -->
<div class="form-group">
<label>卡片宽度:支持像素(px)和百分比(%)默认300px</label>
<label>卡片主体宽度</label>
<input
type="text"
@change=${this._widthChanged}
.value=${this.config.width !== undefined ? this.config.width : '300px'}
name="width"
placeholder="默认300px"
/>
</div>
<!-- 高度设置 -->
<div class="form-group">
<label>卡片高度:支持像素(px)默认300px</label>
<input
type="text"
@change=${this._heightChanged}
.value=${this.config.height !== undefined ? this.config.height : '300px'}
name="height"
placeholder="默认300px"
/>
<div class="help-text">
输入高度值例如300px
</div>
</div>
</div>
`;
}
@@ -1315,7 +1255,6 @@ class XiaoshiPadClimateCard extends LitElement {
return {
hass: { type: Object },
width: { type: String, attribute: true },
height: { type: String, attribute: true },
config: { type: Object },
buttons: { type: Array },
theme: { type: String },
@@ -1344,7 +1283,6 @@ class XiaoshiPadClimateCard extends LitElement {
this.buttons2 = config.buttons2 || [];
this._externalTempSensor = config.temperature || null;
if (config.width !== undefined) this.width = config.width;
if (config.height !== undefined) this.height = config.height;
this.requestUpdate();
}
@@ -1361,7 +1299,7 @@ class XiaoshiPadClimateCard extends LitElement {
position: relative;
background-color: var(--bg-color);
border-radius: 15px;
width: 300px;
width: var(--card-width, 300px);
}
.side-button-wrapper {
@@ -1378,7 +1316,7 @@ class XiaoshiPadClimateCard extends LitElement {
.thermostat-card {
position: relative;
width: 300px;
width: var(--card-width, 300px);
height: 265px;
display: flex;
flex-direction: column;
@@ -1386,7 +1324,7 @@ class XiaoshiPadClimateCard extends LitElement {
.thermostat-container {
flex: 1;
width: 300px;
width: var(--card-width, 300px);
height: 265px;
position: relative;
}
@@ -1523,7 +1461,6 @@ class XiaoshiPadClimateCard extends LitElement {
this.buttons2 = [];
this.theme = 'on';
this.width = '300px';
this.height = '300px';
this._timerInterval = null;
this.temperatureData = [];
this.canvas = null;
@@ -1743,7 +1680,7 @@ class XiaoshiPadClimateCard extends LitElement {
</div>
` : ''}
<div class="main-card" style="--bg-color: ${bgColor}; --fg-color: ${fgColor};">
<div class="main-card" style="--bg-color: ${bgColor}; --fg-color: ${fgColor}; --card-width: ${this.config.width || '300px'};">
<div class="thermostat-card ${themeClass}" style="height: ${cardHeight}px; --card-height: ${cardHeight}px;">
<div class="thermostat-container" id="thermostatContainer"></div>
@@ -2434,4 +2371,4 @@ _renderExtraButtons(buttonType = 1) {
}
}
customElements.define('xiaoshi-pad-climate-card', XiaoshiPadClimateCard);
customElements.define('xiaoshi-pad-climate-card', XiaoshiPadClimateCard);