From d38ee35378095a3331ef4f6c16dfbd1d49547add Mon Sep 17 00:00:00 2001 From: basbruss <68892092+basbruss@users.noreply.github.com> Date: Thu, 16 Feb 2023 10:14:07 +0100 Subject: [PATCH 1/2] Fix: bugs in Thermostat popup --- .../popups/popup_thermostat_temperature.yaml | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/popup_templates/popups/popup_thermostat_temperature.yaml b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/popup_templates/popups/popup_thermostat_temperature.yaml index c5c4f7326..f385ff374 100644 --- a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/popup_templates/popups/popup_thermostat_temperature.yaml +++ b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/popup_templates/popups/popup_thermostat_temperature.yaml @@ -70,42 +70,42 @@ popup_thermostat_temperature: - grid-template-areas: > [[[ var areas = []; - if (variables.ulm_card_thermostat_preset_mode){ - if (entity.attributes.preset_modes.toString().toLowerCase().includes("none")) { + if (variables?.ulm_card_thermostat_preset_mode){ + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("none")) { areas.push("none"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("away")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("away")) { areas.push("away"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("comfort")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("comfort")) { areas.push("comfort"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("home")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("home")) { areas.push("home"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("sleep")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("sleep")) { areas.push("sleep"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("activity")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("activity")) { areas.push("activity"); } } else { - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("auto")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("auto")) { areas.push("auto"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("heat")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat")) { areas.push("heat"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("cool")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("cool")) { areas.push("cool"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("dry")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("dry")) { areas.push("dry"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("fan_only")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("fan_only")) { areas.push("fan_only"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("heat_cool")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat_cool")) { areas.push("heat_cool"); } } @@ -114,42 +114,42 @@ popup_thermostat_temperature: - grid-template-columns: > [[[ var columns = []; - if (variables.ulm_card_thermostat_preset_mode){ - if (entity.attributes.preset_modes.toString().toLowerCase().includes("none")) { + if (variables?.ulm_card_thermostat_preset_mode){ + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("none")) { columns.push("1fr"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("away")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("away")) { columns.push("1fr"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("comfort")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("comfort")) { columns.push("1fr"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("home")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("home")) { columns.push("1fr"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("sleep")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("sleep")) { columns.push("1fr"); } - if (entity.attributes.preset_modes.toString().toLowerCase().includes("activity")) { + if (entity.attributes?.preset_modes.toString().toLowerCase().includes("activity")) { columns.push("1fr"); } } else { - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("auto")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("auto")) { columns.push("1fr"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("heat")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat")) { columns.push("1fr"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("cool")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("cool")) { columns.push("1fr"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("dry")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("dry")) { columns.push("1fr"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("fan_only")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("fan_only")) { columns.push("1fr"); } - if (entity.attributes.hvac_modes.toString().toLowerCase().includes("heat_cool")) { + if (entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat_cool")) { columns.push("1fr"); } } @@ -166,7 +166,7 @@ popup_thermostat_temperature: auto: - display: > [[[ - if (!variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("auto")) { + if (!variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("auto")) { return "block"; } else { return "none"; @@ -175,7 +175,7 @@ popup_thermostat_temperature: heat: - display: > [[[ - if (!variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("heat")) { + if (!variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat")) { return "block"; } else { return "none"; @@ -184,7 +184,7 @@ popup_thermostat_temperature: cool: - display: > [[[ - if (!variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("cool") ) { + if (!variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("cool") ) { return "block"; } else { return "none"; @@ -193,7 +193,7 @@ popup_thermostat_temperature: dry: - display: > [[[ - if ( !variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("dry")) { + if ( !variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("dry")) { return "block"; } else { return "none"; @@ -202,7 +202,7 @@ popup_thermostat_temperature: fan_only: - display: > [[[ - if (!variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("fan_only")) { + if (!variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("fan_only")) { return "block"; } else { return "none"; @@ -211,7 +211,7 @@ popup_thermostat_temperature: heat_cool: - display: > [[[ - if (!variables.ulm_card_thermostat_preset_mode && entity.attributes.hvac_modes.toString().toLowerCase().includes("heat_cool")) { + if (!variables?.ulm_card_thermostat_preset_mode && entity.attributes?.hvac_modes.toString().toLowerCase().includes("heat_cool")) { return "block"; } else { return "none"; @@ -220,7 +220,7 @@ popup_thermostat_temperature: none: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("none")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("none")) { return "block"; } else { return "none"; @@ -229,7 +229,7 @@ popup_thermostat_temperature: away: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("away")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("away")) { return "block"; } else { return "none"; @@ -238,7 +238,7 @@ popup_thermostat_temperature: comfort: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("comfort")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("comfort")) { return "block"; } else { return "none"; @@ -247,7 +247,7 @@ popup_thermostat_temperature: home: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("home")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("home")) { return "block"; } else { return "none"; @@ -256,7 +256,7 @@ popup_thermostat_temperature: sleep: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("sleep")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("sleep")) { return "block"; } else { return "none"; @@ -265,7 +265,7 @@ popup_thermostat_temperature: activity: - display: > [[[ - if (variables.ulm_card_thermostat_preset_mode && entity.attributes.preset_modes.toString().toLowerCase().includes("activity")) { + if (variables?.ulm_card_thermostat_preset_mode && entity.attributes?.preset_modes.toString().toLowerCase().includes("activity")) { return "block"; } else { return "none"; From cfef13a39d64dcecc978ff1ebf73bce65126ca6d Mon Sep 17 00:00:00 2001 From: basbruss <68892092+basbruss@users.noreply.github.com> Date: Thu, 16 Feb 2023 10:19:08 +0100 Subject: [PATCH 2/2] Fix: bug if no entity specified welcome_scenes --- .../card_templates/cards/card_scenes_welcome.yaml | 2 +- .../card_templates/cards/card_welcome_scenes.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_scenes_welcome.yaml b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_scenes_welcome.yaml index ba6b89e27..96d909507 100644 --- a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_scenes_welcome.yaml +++ b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_scenes_welcome.yaml @@ -65,7 +65,7 @@ card_scenes_welcome: - grid-template-areas: > [[[ var pills = [] - const entities = [variables.entity_1.entity_id, variables.entity_2.entity_id, variables.entity_3.entity_id, variables.entity_4.entity_id, variables.entity_5.entity_id, variables.entity_6.entity_id, variables.entity_7.entity_id] + const entities = [variables.entity_1?.entity_id, variables.entity_2?.entity_id, variables.entity_3?.entity_id, variables.entity_4?.entity_id, variables.entity_5?.entity_id, variables.entity_6?.entity_id, variables.entity_7?.entity_id] function entity_check(item) { if (item != "") { pills.push("item" + (pills.length+1)) diff --git a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_welcome_scenes.yaml b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_welcome_scenes.yaml index 8636c7484..cc390a58c 100644 --- a/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_welcome_scenes.yaml +++ b/custom_components/ui_lovelace_minimalist/lovelace/ulm_templates/card_templates/cards/card_welcome_scenes.yaml @@ -243,7 +243,7 @@ card_scenes_pill_welcome: - operator: "template" value: > [[[ - return (entity.state !== 'on' && entity.state !== 'playing' && entity.state != variables?.state) + return (entity?.state !== 'on' && entity?.state !== 'playing' && entity?.state != variables?.state) ]]] styles: card: @@ -341,7 +341,7 @@ card_scenes_pill_welcome: - operator: "template" value: > [[[ - return (entity.state !== 'on' && entity.state !== 'playing' && entity.state != variables?.state) + return (entity?.state !== 'on' && entity?.state !== 'playing' && entity?.state != variables?.state) ]]] styles: card: @@ -400,13 +400,13 @@ card_scenes_pill_welcome: - font-weight: "bold" - font-size: "9.5px" - padding-bottom: "7px" - - overflow: "[[[return (entity.state !== 'on' && entity.state !== 'playing' && entity.state != variables?.state) ? 'visible' : 'hidden']]]" + - overflow: "[[[return (entity?.state !== 'on' && entity?.state !== 'playing' && entity?.state != variables?.state) ? 'visible' : 'hidden']]]" card: - box-shadow: "none" - padding: "0px 5px 5px 5px" - margin-top: "-5px" - border-radius: "50px" - - overflow: "[[[return (entity.state !== 'on' && entity.state !== 'playing' && entity.state != variables?.state) ? 'visible' : 'hidden']]]" + - overflow: "[[[return (entity?.state !== 'on' && entity?.state !== 'playing' && entity?.state != variables?.state) ? 'visible' : 'hidden']]]" card_topbar_welcome: show_icon: false show_name: false