Skip to content

Commit 1d75cd6

Browse files
committed
[TASK] fix browser bugs
1 parent 1b8a589 commit 1d75cd6

File tree

10 files changed

+1046
-817
lines changed

10 files changed

+1046
-817
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Version - 0.8.1](https://img.shields.io/badge/Version-0.8.1-009688?style=for-the-badge)](https://github.com/KartoffelToby/better-thermostat-ui-card)
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)
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

dist/better-thermostat-ui-card.js

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

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "better-thermostat-ui",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "Lovelace better-thermostat-ui",
55
"keywords": [
66
"home-assistant",
@@ -17,10 +17,11 @@
1717
"repository": "",
1818
"author": "",
1919
"dependencies": {
20+
"@juggle/resize-observer": "^3.4.0",
2021
"@mdi/js": "^7.0.96",
2122
"@types/gsap": "^3.0.0",
2223
"custom-card-helpers": "^1.9.0",
23-
"gasp": "^0.0.2",
24+
"gsap": "^3.11.3",
2425
"home-assistant-js-websocket": "^8.0.0",
2526
"lit": "^2.4.0"
2627
},

rollup.config.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ export default {
2929
},
3030
}),
3131
],
32-
};
32+
};

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ export default [
3939
},
4040
plugins: [...plugins],
4141
},
42-
];
42+
];

src/better-thermostat-ui-card.ts

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export class BetterThermostatUiCard extends LitElement {
119119

120120
@state() private _config ? : any;
121121
@state() private _setTemp ? : number | number[];
122+
@state() private _setHumidity?: number | number[];
122123

123124
@query("ha-card") private _card ? : any;
124125

@@ -179,9 +180,9 @@ export class BetterThermostatUiCard extends LitElement {
179180
<text
180181
x="50%"
181182
dx="1"
182-
y="70%"
183+
y="40%"
183184
text-anchor="middle"
184-
style="font-size: 15px;"
185+
style="font-size: 9px;"
185186
>
186187
${
187188
stateObj.state === UNAVAILABLE
@@ -221,7 +222,7 @@ export class BetterThermostatUiCard extends LitElement {
221222
})}
222223
`
223224
}
224-
<tspan dx="-2" dy="-6.5" style="font-size: 5px;">
225+
<tspan dx="-2" dy="-4.5" style="font-size: 3px;">
225226
${this.hass.config.unit_system.temperature}
226227
</tspan>
227228
</text>
@@ -333,10 +334,12 @@ export class BetterThermostatUiCard extends LitElement {
333334
</div>
334335
<div id="temperature">${setValues}</div>
335336
<div id="current-infos">
336-
${currentTemperature}
337-
${
338-
stateObj.attributes.humidity !== null && stateObj.attributes.humidity > 0 ? currentHumidity : ""
339-
}
337+
<div>
338+
${currentTemperature}
339+
${
340+
stateObj.attributes.humidity !== null && stateObj.attributes.humidity > 0 ? currentHumidity : ""
341+
}
342+
</div>
340343
</div>
341344
</div>
342345
</div>
@@ -411,6 +414,7 @@ export class BetterThermostatUiCard extends LitElement {
411414

412415
if (!oldHass || oldHass.states[this._config.entity] !== stateObj) {
413416
this._setTemp = this._getSetTemp(stateObj);
417+
this._setHumidity = this._getHumidity(stateObj);
414418
}
415419
}
416420

@@ -468,6 +472,13 @@ export class BetterThermostatUiCard extends LitElement {
468472
return stateObj.attributes.temperature;
469473
}
470474

475+
private _getHumidity(stateObj: HassEntity): undefined | number | [number, number] {
476+
if (stateObj.attributes.humidity) {
477+
return stateObj.attributes.humidity;
478+
}
479+
return 0;
480+
}
481+
471482
private _dragEvent(e): void {
472483
const stateObj = this.hass!.states[this._config!.entity] as any;
473484

@@ -734,7 +745,6 @@ export class BetterThermostatUiCard extends LitElement {
734745
return css `
735746
:host {
736747
display: block;
737-
min-width: 300px;
738748
}
739749
.humindity, .temperature {
740750
display: grid;
@@ -891,28 +901,37 @@ export class BetterThermostatUiCard extends LitElement {
891901
flex-flow: column;
892902
}
893903
#temperature {
904+
/*
894905
height: 35%;
895906
display: inline-flex;
896907
justify-content: center;
908+
*/
909+
height: 30%;
897910
}
898911
#current-infos {
899-
display: inline-flex;
900-
flex-flow: row;
901-
justify-content: center;
902-
gap: 0.4em;
903-
padding-bottom: 0.5em;
912+
display: inherit;
913+
padding-bottom: 1.5em;
904914
padding-top: 0.7em;
905-
font-size: 18px !important;
906915
height: 30px;
907916
position: relative;
908-
width: 65%;
917+
width: 100%;
909918
overflow: visible;
910-
margin: 0 auto;
911-
margin-top: 0.6em;
919+
top: 10%;
920+
left: 50%;
921+
transform: translateX(-50%);
922+
}
923+
#current-infos div {
924+
width: 60%;
925+
display: inherit;
926+
margin: 0px 12%;
927+
gap: 1em;
928+
}
929+
#current-infos svg {
930+
width: inherit;
912931
}
913932
#current-infos:before {
914933
content: attr(data-before);
915-
width: 95%;
934+
width: 70%;
916935
height: 2px;
917936
display: inline-block;
918937
position: absolute;
@@ -923,6 +942,11 @@ export class BetterThermostatUiCard extends LitElement {
923942
padding: 2em;
924943
font-size: 9px;
925944
opacity: 0.65;
945+
overflow: visible;
946+
left: 50%;
947+
transform: translateX(-50%);
948+
font-size: 10px;
949+
}
926950
}
927951
#set-values {
928952
}
@@ -948,6 +972,9 @@ export class BetterThermostatUiCard extends LitElement {
948972
text {
949973
fill: var(--primary-text-color);
950974
}
975+
svg {
976+
overflow: visible;
977+
}
951978
`;
952979
}
953980
}

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.1';
1+
export const CARD_VERSION = '0.8.2';

0 commit comments

Comments
 (0)