Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes disable_cool and disable_auto along with localisation #15

Merged
merged 11 commits into from
Dec 6, 2023
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Note: those options should be improved with official release
| disable_overpowering | boolean | **optional** | turn off the overpowering indicator |
| disable_heat | boolean | **optional** | turn off the on/heat button |
| disable_cool | boolean | **optional** | turn off the on/cool button |
| disable_heat_cool | boolean | **optional** | turn off the on/heat_cool button |
| disable_auto | boolean | **optional** | turn off the on/auto button |
| disable_dry | boolean | **optional** | turn off the on/dry button |
| disable_fan_only | boolean | **optional** | turn off the on/fan_only button |
| disable_off | boolean | **optional** | turn off the off button |
| disable_buttons | boolean | **optional** | turn off the plus/minus buttons |
| disable_security_warning | boolean | **optional** | turn off the security warning (when a temperature sensor is out) |
Expand All @@ -79,8 +83,12 @@ type: custom:versatile-thermostat-ui-card
entity: climate.thermostat_switch_1
disable_window: false
disable_overpowering: false
disable_cool: false
disable_heat: false
disable_cool: false
disable_heat_cool: false
disable_auto: false
disable_dry: false
disable_fan_only: false
disable_menu: false
disable_off: false
disable_security_warning: false
Expand Down
12 changes: 6 additions & 6 deletions dist/versatile-thermostat-ui-card.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/climate-card-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ export type ClimateCardConfig = LovelaceCardConfig &
disable_name?: boolean;
disable_window?: boolean;
disable_overpowering?: boolean;
disable_eco?: boolean;
disable_heat?: boolean;
disable_cool?: boolean;
disable_heat_cool?: boolean;
disable_auto?: boolean;
disable_dry?: boolean;
disable_fan_only?: boolean;
disable_off?: boolean;
disable_menu?: boolean;
disable_security_warning?: boolean;
Expand All @@ -50,9 +53,12 @@ export const climateCardConfigStruct = assign(
disable_name: optional(boolean()),
disable_window: optional(boolean()),
disable_overpowering: optional(boolean()),
disable_eco: optional(boolean()),
disable_heat: optional(boolean()),
disable_cool: optional(boolean()),
disable_heat_cool: optional(boolean()),
disable_auto: optional(boolean()),
disable_dry: optional(boolean()),
disable_fan_only: optional(boolean()),
disable_off: optional(boolean()),
disable_security_warning: optional(boolean()),
disable_power_infos: optional(boolean()),
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Zakázat okno",
"disable_overpowering": "Zakázat léto",
"disable_eco": "Zakázat eco",
"disable_heat": "Zakázat topení",
"disable_cool": "Zakázat chlazení",
"disable_heat_cool": "Zakázat topení/chlazení",
"disable_auto": "Zakázať automatic",
"disable_fan_only": "Zakázat pouze ventilátor",
"disable_dry": "Zakázat sušení",
"disable_off": "Zakázat vypnuto",
"disable_menu": "Zakázat menu",
"disable_security_warning": "Zakázat upozornění baterie",
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Fenster-offen-Anzeige deaktivieren",
"disable_overpowering": "Sommer-Anzeige deaktivieren",
"disable_eco": "Eco-Anzeige deaktivieren",
"disable_heat": "Heiz-Anzeige deaktivieren",
"disable_cool": "Kühl-Anzeige deaktivieren",
"disable_heat_cool": "Heiz-/Kühl-Anzeige deaktivieren",
"disable_auto": "Auto-Anzeige deaktivieren",
"disable_fan_only": "Nur-Lüften-Anzeige deaktivieren",
"disable_dry": "Trocknen-Anzeige deaktivieren",
"disable_off": "Aus-Anzeige deaktivieren",
"disable_menu": "Menü deaktivieren",
"disable_security_warning": "Batterie-Warnung deaktivieren",
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Disable window",
"disable_overpowering": "Disable overpowering",
"disable_eco": "Disable eco",
"disable_heat": "Disable heat",
"disable_cool": "Disable cool",
"disable_heat_cool": "Disable heat/cool",
"disable_auto": "Disable auto",
"disable_fan_only": "Disable fan only",
"disable_dry": "Disable dry",
"disable_off": "Disable off",
"disable_menu": "Disable menu",
"set_current_as_main": "Exchange target temperature and room temperature",
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Désactiver fenêtre status",
"disable_overpowering": "Désactiver sur-puissance status",
"disable_cool": "Désactiver mode clim",
"disable_heat": "Désactiver mode chauffe",
"disable_cool": "Désactiver mode clim",
"disable_heat_cool": "Désactiver mode chauffe/clim",
"disable_auto": "Désactiver mode auto",
"disable_fan_only": "Désactiver mode ventilation",
"disable_dry": "Désactiver mode déshumidification",
"disable_off": "Désactiver arret",
"set_current_as_main": "Echanger temperature cible avec temperature locale",
"disable_security_warning": "Désactiver sécurité messages",
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Ablak kikapcsolás",
"disable_overpowering": "Nyár kikapcsolás",
"disable_eco": "Eco kikapcsolás",
"disable_heat": "Fűtés kikacsolás",
"disable_cool": "Hűtés kikapcsolás",
"disable_heat_cool": "Fűtés/Hűtés kikapcsolás",
"disable_auto": "Auto kikapcsolás",
"disable_fan_only": "Csak ventillátor kikapcsolás",
"disable_dry": "Szárítás kikapcsolás",
"disable_off": "Kikapcsolás inaktiválás",
"eco_temperature": "Eco hőmérséklet",
"set_current_as_main": "Aktuális hőmérséklet használata"
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Disabilita indicatore Finestra",
"disable_overpowering": "Disabilita indicatore Estate",
"disable_eco": "Disabilita tasto eco",
"disable_heat": "Disabilita tasto heat",
"disable_cool": "Disabilita tasto cool",
"disable_heat_cool": "Disabilita tasto heat/cool",
"disable_auto": "Disabilita tasto auto",
"disable_fan_only": "Disabilita tasto fan only",
"disable_dry": "Disabilita tasto dry",
"disable_off": "Disabililita tasto off",
"eco_temperature": "Temperatura target",
"set_current_as_main": "Imposta la temperatura attuale come target"
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Desactivar Janela",
"disable_overpowering": "Desactivar Verão",
"disable_eco": "Desactivar Eco",
"disable_heat": "Desactivar Aquecimento",
"disable_cool": "Desactivar Arrefecimento",
"disable_heat_cool": "Desactivar Aquecimento/Arrefecimento",
"disable_auto": "Desactivar Auto",
"disable_fan_only": "Desactivar Ventilação",
"disable_dry": "Desactivar Secagem",
"disable_off": "Desactivar Off",
"eco_temperature": "Modo Eco",
"set_current_as_main": "Mudar para a temperatura local actual"
Expand Down
6 changes: 5 additions & 1 deletion src/localize/languages/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"climate": {
"disable_window": "Zakázať okno",
"disable_overpowering": "Zakázať leto",
"disable_eco": "Zakázať eco",
"disable_heat": "Zakázať kúrenie",
"disable_cool": "Zakázať chladenie",
"disable_heat_cool": "Zakázať kúrenie/chladenie",
"disable_auto": "Zakázat automatic",
"disable_fan_only": "Zakázať režim ventilátora",
"disable_dry": "Zakázať sušenie",
"disable_off": "Vypnúť",
"disable_menu": "Zakázať menu",
"disable_security_warning": "Zakázať upozornenie na batériu",
Expand Down
50 changes: 26 additions & 24 deletions src/versatile-thermostat-ui-card-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,33 @@ const loadHaComponents = (version: string) => {
}
};

const CLIMATE_LABELS = ["disable_name", "disable_window", "disable_overpowering", "disable_heat", "disable_cool", "disable_off", "disable_menu", "disable_security_warning", "disable_buttons", "set_current_as_main", "disable_power_infos"] as string[];
const CLIMATE_LABELS = ["disable_name", "disable_window", "disable_overpowering", "disable_heat", "disable_cool", "disable_heat_cool", "disable_auto", "disable_dry", "disable_fan_only", "disable_off", "disable_menu", "disable_security_warning", "disable_buttons", "set_current_as_main", "disable_power_infos"] as string[];

const computeSchema = memoizeOne(
(): any[] => [
{ name: "entity", selector: { entity: { domain: ["climate"] } } },
{ name: "name", selector: { text: {} } },
{
type: "grid",
name: "",
schema: [
{ name: "disable_name", selector: { boolean: {} } },
{ name: "disable_window", selector: { boolean: {} } },
{ name: "disable_overpowering", selector: { boolean: {} } },
{ name: "disable_heat", selector: { boolean: {} } },
{ name: "disable_cool", selector: { boolean: {} } },
{ name: "disable_off", selector: { boolean: {} } },
{ name: "disable_menu", selector: { boolean: {} } },
{ name: "disable_security_warning", selector: { boolean: {} } },
{ name: "disable_buttons", selector: { boolean: {}}},
{ name: "set_current_as_main", selector: { boolean: {}}},
{ name: "disable_power_infos", selector: { Boolean: {}}}
],
},
]
);
const computeSchema = memoizeOne((): any[] => [
{ name: "entity", selector: { entity: { domain: ["climate"] } } },
{ name: "name", selector: { text: {} } },
{
type: "grid",
name: "",
schema: [
{ name: "disable_name", selector: { boolean: {} } },
{ name: "disable_window", selector: { boolean: {} } },
{ name: "disable_overpowering", selector: { boolean: {} } },
{ name: "disable_heat", selector: { boolean: {} } },
{ name: "disable_cool", selector: { boolean: {} } },
{ name: "disable_heat_cool", selector: { boolean: {} } },
{ name: "disable_auto", selector: { boolean: {} } },
{ name: "disable_dry", selector: { boolean: {} } },
{ name: "disable_fan_only", selector: { boolean: {} } },
{ name: "disable_off", selector: { boolean: {} } },
{ name: "disable_menu", selector: { boolean: {} } },
{ name: "disable_security_warning", selector: { boolean: {} } },
{ name: "disable_buttons", selector: { boolean: {} } },
{ name: "set_current_as_main", selector: { boolean: {} } },
{ name: "disable_power_infos", selector: { Boolean: {} } },
],
},
]);

@customElement("versatile-thermostat-ui-card-editor")
export class ClimateCardEditor extends LitElement implements LovelaceCardEditor {
Expand Down
9 changes: 6 additions & 3 deletions src/versatile-thermostat-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1259,9 +1259,12 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard {
<div id="modes">
${svg`
${this.modes.map((mode) => {
if(this._config?.disable_heat && (mode === "heat" || mode === "heat_cool")) return html ``;
if(this._config?.disable_eco && mode === "cool") return html ``;
if(this._config?.disable_cool && mode === "eco") return html ``;
if(this._config?.disable_heat && mode === "heat") return html ``;
if(this._config?.disable_auto && mode === "auto") return html ``;
if(this._config?.disable_cool && mode === "cool") return html ``;
if(this._config?.disable_heat_cool && mode === "heat_cool") return html ``;
if(this._config?.disable_dry && mode === "dry") return html ``;
if(this._config?.disable_fan_only && mode === "fan_only") return html ``;
if(this._config?.disable_off && mode === "off") return html ``;
return this._renderIcon(mode, this.mode);
})}
Expand Down