Skip to content

Commit 19fdaa9

Browse files
committed
[TASK] new disable functions and layout fix
1 parent c143157 commit 19fdaa9

File tree

7 files changed

+52
-19
lines changed

7 files changed

+52
-19
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Version - 0.8.2](https://img.shields.io/badge/Version-0.8.2-009688?style=for-the-badge)](https://github.com/KartoffelToby/better-thermostat-ui-card)
1+
[![Version - 0.9.0](https://img.shields.io/badge/Version-0.9.0-009688?style=for-the-badge)](https://github.com/KartoffelToby/better-thermostat-ui-card)
22
[![Discord](https://img.shields.io/discord/925725316540923914.svg?style=for-the-badge)](https://discord.gg/9BUegWTG3K)
33
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
44

@@ -26,7 +26,10 @@ As for now the main improvment is the ability to see the extra status from bette
2626
| eco_temperature | number | **optional** | target temp for night/away/eco mode triggerd by ui button |
2727
| disable_window | boolean | **optional** | turn off the window open indicator |
2828
| disable_summer | boolean | **optional** | trun off the summer indicator |
29-
29+
| disable_heat | boolean | **optional** | trun off the on/heat button |
30+
| disable_eco | boolean | **optional** | trun off the eco button |
31+
| disable_off | boolean | **optional** | trun off the off button |
32+
| name | string/boolean | **optional** | override the default entity name, us false to
3033

3134
## Help wanted!
3235

dist/better-thermostat-ui-card.js

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "better-thermostat-ui",
3-
"version": "0.8.2",
3+
"version": "0.9.0",
44
"description": "Lovelace better-thermostat-ui",
55
"keywords": [
66
"home-assistant",

src/better-thermostat-ui-card.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ export class BetterThermostatUiCard extends LitElement {
148148
}
149149

150150
const mode = stateObj.state in modeIcons ? stateObj.state : "unknown-mode";
151-
const name =
151+
let name =
152152
this._config!.name ||
153153
this.computeStateName(this.hass!.states[this._config!.entity]);
154+
if(this._config!.name === false) {
155+
name = "";
156+
}
154157
const targetTemp =
155158
stateObj.attributes.temperature !== null &&
156159
Number.isFinite(Number(stateObj.attributes.temperature)) ?
@@ -334,7 +337,7 @@ export class BetterThermostatUiCard extends LitElement {
334337
</div>
335338
<div id="temperature">${setValues}</div>
336339
<div id="current-infos">
337-
<div>
340+
<div class="${stateObj.attributes.humidity !== null && stateObj.attributes.humidity > 0 ? 'two': 'one'}">
338341
${currentTemperature}
339342
${
340343
stateObj.attributes.humidity !== null && stateObj.attributes.humidity > 0 ? currentHumidity : ""
@@ -346,13 +349,13 @@ export class BetterThermostatUiCard extends LitElement {
346349
</div>
347350
<div id="info" .title=${name}>
348351
<div id="modes">
349-
${this._renderIcon("heat", mode)}
350-
${
352+
${this._config.disable_heat ? html `` : this._renderIcon("heat", mode)}
353+
${this._config.disable_eco ? html `` :
351354
stateObj.attributes.saved_temperature &&
352355
stateObj.attributes.saved_temperature !== "none" &&
353356
stateObj.state !== UNAVAILABLE
354357
? this._renderIcon("eco","eco"): this._renderIcon("eco", "none")}
355-
${this._renderIcon("off", mode)}
358+
${this._config.disable_off ? html `` : this._renderIcon("off", mode)}
356359
</div>
357360
</div>
358361
<div id="title">${name}</div>
@@ -920,11 +923,17 @@ export class BetterThermostatUiCard extends LitElement {
920923
left: 50%;
921924
transform: translateX(-50%);
922925
}
923-
#current-infos div {
926+
#current-infos div.two {
924927
width: 60%;
925928
display: inherit;
926929
margin: 0px 12%;
927930
gap: 1em;
931+
}
932+
#current-infos div.one {
933+
width: 100%;
934+
display: inherit;
935+
margin: 0px 12%;
936+
gap: 1em;
928937
}
929938
#current-infos svg {
930939
width: inherit;

src/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const CARD_VERSION = '0.8.2';
1+
export const CARD_VERSION = '0.9.0';

src/editor.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ export class BetterThermostatUiCardEditor extends LitElement implements Lovelace
6161
return this._config?.disable_summer || false;
6262
}
6363

64+
get _disable_eco(): boolean {
65+
return this._config?.disable_eco || false;
66+
}
67+
68+
get _disable_heat(): boolean {
69+
return this._config?.disable_heat || false;
70+
}
71+
72+
get _disable_off(): boolean {
73+
return this._config?.disable_off || false;
74+
}
75+
6476
get _show_warning(): boolean {
6577
return this._config?.show_warning || false;
6678
}

src/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface BetterThermostatUiCardConfig extends LovelaceCardConfig {
1313
eco_temperature?: number;
1414
disable_window?: boolean;
1515
disable_summer?: boolean;
16+
disable_eco?: boolean;
17+
disable_heat?: boolean;
18+
disable_off?: boolean;
1619
theme?: string;
17-
name?: string;
20+
name?: any;
1821
}

0 commit comments

Comments
 (0)