From 7bdc5f89fbc36aa82c16ead60625707a5f6d70fc Mon Sep 17 00:00:00 2001 From: wilbiev Date: Sat, 14 Dec 2024 12:01:40 +0000 Subject: [PATCH] Restore deleted custom cards --- .../custom_card_bar_card.yaml | 69 +++++ .../custom_card_eraycetinay_lock/README.md | 116 +++++++++ .../custom_card_eraycetinay_lock.yaml | 115 ++++++++ .../languages/de.yaml | 11 + .../languages/en.yaml | 11 + .../languages/es.yaml | 11 + .../languages/pl.yaml | 11 + .../languages/sv.yaml | 11 + .../languages/tr.yaml | 11 + .../custom_card_irmajavi_speedtest.yaml | 245 ++++++++++++++++++ .../custom_card_mpse_printer.yaml | 220 ++++++++++++++++ .../custom_card_paddy_dwd_pollen.yaml | 69 +++++ .../custom_card_sisimomo_printer.yaml | 222 ++++++++++++++++ 13 files changed, 1122 insertions(+) create mode 100644 custom_cards/custom_card_bar_card/custom_card_bar_card.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/README.md create mode 100644 custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/de.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/en.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/es.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml create mode 100644 custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml create mode 100644 custom_cards/custom_card_irmajavi_speedtest/custom_card_irmajavi_speedtest.yaml create mode 100644 custom_cards/custom_card_mpse_printer/custom_card_mpse_printer.yaml create mode 100644 custom_cards/custom_card_paddy_dwd_pollen/custom_card_paddy_dwd_pollen.yaml create mode 100644 custom_cards/custom_card_sisimomo_printer/custom_card_sisimomo_printer.yaml diff --git a/custom_cards/custom_card_bar_card/custom_card_bar_card.yaml b/custom_cards/custom_card_bar_card/custom_card_bar_card.yaml new file mode 100644 index 000000000..dcb4ca712 --- /dev/null +++ b/custom_cards/custom_card_bar_card/custom_card_bar_card.yaml @@ -0,0 +1,69 @@ +--- +custom_card_bar_card: + variables: + ulm_custom_card_bar_card_color: "var(--google-blue)" + ulm_custom_card_bar_card_min: "0" + ulm_custom_card_bar_card_max: "100" + triggers_update: "all" + styles: + grid: + - grid-template-areas: "'item1' 'item2'" + - grid-template-rows: "1fr" + card: + - border-radius: "var(--border-radius)" + - box-shadow: "var(--box-shadow)" + - padding: "0px" + custom_fields: + item1: + card: + type: "custom:button-card" + template: + - "icon_info" + - "card_generic" + variables: + ulm_card_generic_name: "[[[ return variables.ulm_custom_card_bar_card_name != '' ? variables.ulm_custom_card_bar_card_name : '' ]]]" + ulm_card_generic_icon: "[[[ return variables.ulm_custom_card_bar_card_icon != '' ? variables.ulm_custom_card_bar_card_icon : '' ]]]" + styles: + card: + - box-shadow: "none" + - border-radius: "var(--border-radius) var(--border-radius) 0px 0px" + - padding: "12px" + entity: "[[[ return variables.ulm_custom_card_bar_card_entity ]]]" + item2: + card: + type: "custom:bar-card" + entities: + - entity: "[[[ return variables.ulm_custom_card_bar_card_entity ]]]" + color: "[[[ return variables.ulm_custom_card_bar_card_color ]]]" + positions: + icon: "off" + indicator: "[[[ return variables.ulm_custom_card_bar_card_indicator == true ? 'inside' : 'off' ]]]" + minmax: "off" + title: "off" + value: "[[[ return variables.ulm_custom_card_bar_card_value == true ? 'inside' : 'off' ]]]" + name: "off" + min: "[[[ return variables.ulm_custom_card_bar_card_min ]]]" + max: "[[[ return variables.ulm_custom_card_bar_card_max ]]]" + style: |- + bar-card-currentbar { + border-radius: 0px !important; + right: 0; + } + bar-card-backgroundbar { + border-radius: 0px !important; + right: 0; + } + #states { + padding: 0; + height: 35px; + } + bar-card-background { + height: 35px !important; + } + bar-card-indicator { + left: 10px; + } + bar-card-value { + font-weight: bold; + font-size: 12px; + } diff --git a/custom_cards/custom_card_eraycetinay_lock/README.md b/custom_cards/custom_card_eraycetinay_lock/README.md new file mode 100644 index 000000000..777c75ac2 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/README.md @@ -0,0 +1,116 @@ +--- +title: Lock Card Custom-card +hide: + - toc +--- + + + +# Custom-card "Lock" + +This is a `custom-card` that works in switch logic with a `lock` entity. Card structure uses `lock`, `unlock` (optional `open`) actions and `lock`,`unlock`,`locking`,`unlocking`, `jammed` states. + +![Generic](../../docs/assets/img/custom_card_eraycetinay_lock.png) + +## Credits + +Author: eraycetinay - 2022 +Version: 0.0.3 + +## Changelog + +
+ 0.0.3 + +
+
+ 0.0.2 + Added option to only use lock.open +
+
+ 0.0.1 + Initial release +
+ +## Usage + +```yaml +- type: "custom:button-card" + entity: lock.door_lock + template: "custom_card_eraycetinay_lock" + name: "Door Lock" + variables: + ulm_custom_card_eraycetinay_lock_tap_control: true + ulm_custom_card_eraycetinay_lock_battery_level: sensor.door_battery + ulm_custom_card_eraycetinay_lock_door_open: binary_sensor.door_open + triggers_update: + - "sensor.door_battery" + - "binary_sensor.door_open" +``` + +## Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariableExampleDefaultRequiredExplanation
ulm_custom_card_eraycetinay_lock_tap_controltruefalsenoLock/Unlock on tap action
ulm_custom_card_eraycetinay_lock_only_opentruefalsenoOnly use the card to open the door (always sends lock.open on tap)
ulm_custom_card_eraycetinay_lock_battery_levelsensor.door_batterynoDisplays a warning when the battery is low.
ulm_custom_card_eraycetinay_lock_battery_warning2520noAt what battery percentage should the low battery warning appear.
ulm_custom_card_eraycetinay_lock_battery_warning_low105noAt what battery percentage should the very low battery warning appear.
ulm_custom_card_eraycetinay_lock_door_openbinary_sensor.door_opennoDisplays a warning when the door is lock but the door is still open.
+ +??? note "Template Code" + + ```yaml title="custom_card_eraycetinay_lock.yaml" + --8<-- "custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml" + ``` diff --git a/custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml b/custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml new file mode 100644 index 000000000..4c2447996 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml @@ -0,0 +1,115 @@ +--- +custom_card_eraycetinay_lock: + template: + - "icon_info_bg" + - "ulm_translation_engine" + - "custom_card_eraycetinay_lock_language_variables" + variables: + ulm_custom_card_eraycetinay_lock_battery_warning: 20 + ulm_custom_card_eraycetinay_lock_battery_warning_low: 5 + tap_action: + action: | + [[[ + return variables.ulm_custom_card_eraycetinay_lock_tap_control ? "call-service" : "more-info"; + ]]] + # only related with call-service action + service: | + [[[ + if(variables.ulm_custom_card_eraycetinay_lock_tap_control){ + if(variables.ulm_custom_card_eraycetinay_lock_open){ + return "lock.open"; + } else { + if (entity.state == "locked"){ + return "lock.unlock"; + } else if (entity.state == "unlocked"){ + return "lock.lock"; + } + } + } + ]]] + # only related with call-service action + service_data: + entity_id: | + [[[ return entity.entity_id; ]]] + show_label: true + show_name: true + triggers_update: + - "[[[ return entity.entity_id; ]]]" + label: "[[[ return variables.ulm_translation_state ]]]" + state: + - operator: "template" + value: | + [[[ return entity.state == ("unlocked" || "open" || "opened"); ]]] + styles: + icon: + - color: "rgba(var(--color-yellow),1)" + img_cell: + - background-color: "rgba(var(--color-yellow), 0.2)" + - operator: "template" + value: | + [[[ return entity.state == "locked" || "closed"; ]]] + styles: + icon: + - color: "rgba(var(--color-green),1)" + img_cell: + - background-color: "rgba(var(--color-green), 0.2)" + styles: + icon: + - color: "rgba(var(--color-theme),0.2)" + img_cell: + - background-color: "rgba(var(--color-theme),0.05)" + - border-radius: "50%" + - place-self: "center" + - width: "42px" + - height: "42px" + grid: + - position: "relative" + custom_fields: + notification_locked_and_opened: + - border-radius: "50%" + - position: "absolute" + - left: "28px" + - top: "-6px" + - height: "16px" + - width: "16px" + - border: "2px solid var(--card-background-color)" + - font-size: "12px" + - line-height: "14px" + - background-color: "[[[ return 'rgba(var(--color-red),1)'; ]]]" + notification_battery: + - border-radius: "50%" + - position: "absolute" + - left: "-6px" + - top: "-6px" + - height: "16px" + - width: "16px" + - border: "2px solid var(--card-background-color)" + - font-size: "12px" + - line-height: "14px" + - background-color: | + [[[ + if (variables.ulm_custom_card_eraycetinay_lock_battery_level !== undefined) { + if (states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state <= variables.ulm_custom_card_eraycetinay_lock_battery_warning_low) { + return "rgba(var(--color-red),1)"; + } else if (states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state <= variables.ulm_custom_card_eraycetinay_lock_battery_warning) { + return "rgba(var(--color-yellow),1)"; + } + } + ]]] + custom_fields: + notification_locked_and_opened: > + [[[ + if (variables.ulm_custom_card_eraycetinay_lock_door_open !== undefined && (entity.state === "locked" && states[variables.ulm_custom_card_eraycetinay_lock_door_open].state === "on")) { + return ``; + } + ]]] + notification_battery: > + [[[ + if (variables.ulm_custom_card_eraycetinay_lock_battery_level !== undefined) { + if (variables.ulm_custom_card_eraycetinay_lock_battery_warning >= states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state) { + return ` + + `; + } + } + ]]] diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/de.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/de.yaml new file mode 100644 index 000000000..1305d95eb --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/de.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "verriegelt" + custom_card_eraycetinay_lock_unlocked: "entriegelt" + custom_card_eraycetinay_lock_locking: "verriegeln" + custom_card_eraycetinay_lock_unlocking: "entriegeln" + custom_card_eraycetinay_lock_unavailable: "nicht verfügbar" + custom_card_eraycetinay_lock_jammed: "blockiert" + custom_card_eraycetinay_lock_locked_and_opened: "Die Tür ist verschlossen, aber noch offen." + custom_card_eraycetinay_lock_battery_is_at: "Batterie ist an" diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/en.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/en.yaml new file mode 100644 index 000000000..f34a60515 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/en.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "locked" + custom_card_eraycetinay_lock_unlocked: "unlocked" + custom_card_eraycetinay_lock_locking: "locking" + custom_card_eraycetinay_lock_unlocking: "unlocking" + custom_card_eraycetinay_lock_unavailable: "unavailable" + custom_card_eraycetinay_lock_jammed: "jammed" + custom_card_eraycetinay_lock_locked_and_opened: "The door is locked but still open." + custom_card_eraycetinay_lock_battery_is_at: "Battery is at" diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/es.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/es.yaml new file mode 100644 index 000000000..637d3c74c --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/es.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "bloqueado" + custom_card_eraycetinay_lock_unlocked: "desbloqueado" + custom_card_eraycetinay_lock_locking: "bloqueando" + custom_card_eraycetinay_lock_unlocking: "desbloqueando" + custom_card_eraycetinay_lock_unavailable: "no disponible" + custom_card_eraycetinay_lock_jammed: "apretada" + custom_card_eraycetinay_lock_locked_and_opened: "La puerta está cerrada pero aún abierta." + custom_card_eraycetinay_lock_battery_is_at: "la batería está en" diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml new file mode 100644 index 000000000..b00d13270 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "zamknięty" + custom_card_eraycetinay_lock_unlocked: "otwarty" + custom_card_eraycetinay_lock_locking: "zamykanie" + custom_card_eraycetinay_lock_unlocking: "otwieranie" + custom_card_eraycetinay_lock_unavailable: "niedostępny" + custom_card_eraycetinay_lock_jammed: "zacięty" + custom_card_eraycetinay_lock_locked_and_opened: "Drzwi są zamknięte, ale nadal otwarte." + custom_card_eraycetinay_lock_battery_is_at: "Bateria jest na" diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml new file mode 100644 index 000000000..707eab945 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "låst" + custom_card_eraycetinay_lock_unlocked: "olåst" + custom_card_eraycetinay_lock_locking: "låser" + custom_card_eraycetinay_lock_unlocking: "låser upp" + custom_card_eraycetinay_lock_unavailable: "otillgängligt" + custom_card_eraycetinay_lock_jammed: "fastnat" + custom_card_eraycetinay_lock_locked_and_opened: "Dörren är låst men fortfarande öppen." + custom_card_eraycetinay_lock_battery_is_at: "Batterinivån är" diff --git a/custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml b/custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml new file mode 100644 index 000000000..e612ab5f2 --- /dev/null +++ b/custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml @@ -0,0 +1,11 @@ +--- +custom_card_eraycetinay_lock_language_variables: + variables: + custom_card_eraycetinay_lock_locked: "kilitli" + custom_card_eraycetinay_lock_unlocked: "kilitli değil" + custom_card_eraycetinay_lock_locking: "kilitleniyor" + custom_card_eraycetinay_lock_unlocking: "kilit açılıyor" + custom_card_eraycetinay_lock_unavailable: "müsait değil" + custom_card_eraycetinay_lock_jammed: "sıkışmış" + custom_card_eraycetinay_lock_locked_and_opened: "Kapı kilitli ama hala açık" + custom_card_eraycetinay_lock_battery_is_at: "pil" diff --git a/custom_cards/custom_card_irmajavi_speedtest/custom_card_irmajavi_speedtest.yaml b/custom_cards/custom_card_irmajavi_speedtest/custom_card_irmajavi_speedtest.yaml new file mode 100644 index 000000000..d4a204be1 --- /dev/null +++ b/custom_cards/custom_card_irmajavi_speedtest/custom_card_irmajavi_speedtest.yaml @@ -0,0 +1,245 @@ +--- +custom_card_irmajavi_speedtest: + triggers_update: "all" + show_name: false + show_label: false + template: + - "ulm_custom_card_irmajavi_speedtest_language_variables" + variables: + ulm_custom_card_irmajavi_speedtest_color: "blue" + ulm_custom_card_irmajavi_speedtest_router_name: "router_name" + ulm_custom_card_irmajavi_speedtest_router_model: "router_model" + styles: + grid: + - grid-template-areas: "'item1' 'item2' 'item3'" + - grid-template-columns: "1fr" + - grid-template-rows: "min-content min-content" + - row-gap: "12px" + card: + - border-radius: "var(--border-radius)" + - box-shadow: "var(--box-shadow)" + - padding: "12px" + custom_fields: + item1: + card: + type: "custom:button-card" + tap_action: + action: "none" + show_last_changed: false + show_label: true + show_name: true + show_icon: true + label: >- + [[[ return variables.ulm_custom_card_irmajavi_speedtest_router_model + ]]] + name: >- + [[[ return variables.ulm_custom_card_irmajavi_speedtest_router_name + ]]] + icon: "mdi:wifi" + styles: + icon: + - color: >- + [[[ return + `rgba(var(--color-${variables.ulm_custom_card_irmajavi_speedtest_color}), + 1)`; ]]] + - width: "32px" + label: + - justify-self: "center" + - align-self: "start" + - font-weight: "bolder" + - font-size: "12px" + - filter: "opacity(40%)" + name: + - margin-top: "10px" + - justify-self: "center" + - font-weight: "bold" + - font-size: "14px" + img_cell: + - background-color: >- + [[[ return + `rgba(var(--color-${variables.ulm_custom_card_irmajavi_speedtest_color}), + 0.2)`; ]]] + - border-radius: "50%" + - place-self: "center" + - width: "62px" + - height: "62px" + grid: + - grid-template-areas: "'i' 'n' 'l'" + card: + - box-shadow: "none" + size: "20px" + item2: + card: + type: "custom:button-card" + tap_action: + action: "call-service" + service: "homeassistant.update_entity" + service_data: + entity_id: + - "[[[ return variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity]]]" + - "[[[ return variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity]]]" + - "[[[ return variables.ulm_custom_card_irmajavi_speedtest_ping_entity]]]" + color: "var(--google-grey)" + show_icon: true + show_label: false + show_name: true + styles: + custom_fields: + item1: + - justify-self: "end" + - margin-top: "-23px" + - margin-right: "3px" + icon: + - color: "rgba(var(--color-theme),0.9)" + - width: "20px" + img_cell: + - background-color: "none" + - place-self: "center" + - justify-self: "start" + - width: "40px" + - height: "20px" + name: + - align-self: "end" + - justify-self: "start" + - font-weight: "bold" + - font-size: "16px" + - margin-left: "40px" + - margin-top: "3px" + grid: + - grid-template-areas: "i n item1" + - grid-template-columns: "min-content" + - grid-template-rows: "auto" + card: + - box-shadow: "none" + - border-radius: "10px" + - border: "2px solid var(--google-grey)" + - padding_bottom: "-8px" + - height: "40px" + - padding-top: "5px" + - padding-left: "5px" + name: "[[[ return variables.ulm_custom_card_irmajavi_speedtest_speedtest ]]]" + icon: "mdi:speedometer" + custom_fields: + item1: + card: + type: "custom:button-card" + show_icon: true + show_name: false + show_label: false + styles: + icon: + - color: "rgba(var(--color-theme),0.9)" + - width: "20px" + - justify-self: "end" + grid: + - grid-template-areas: "i" + - grid-template-columns: "auto" + - grid-template-rows: "auto" + card: + - box-shadow: "none" + icon: "mdi:chevron-right" + item3: + card: + type: "custom:button-card" + template: "list_2_items" + custom_fields: + item1: + card: + type: "custom:button-card" + tap_action: + action: "more-info" + color: "var(--google-blue)" + show_label: true + show_icon: false + name: "[[[ return variables.ulm_custom_card_irmajavi_speedtest_download ]]]" + entity: >- + [[[ return + variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity; + ]]] + label: | + [[[ + var state1 = ""; + if (states[variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity].state){ + var state1 = states[variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity].state; + if (states[variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity].attributes.unit_of_measurement){ + state1 += states[variables.ulm_custom_card_irmajavi_speedtest_download_speed_entity].attributes.unit_of_measurement; + } + } + return state1; + ]]] + styles: + icon: + - width: "30px" + - height: "30px" + label: + - align-self: "center" + - justify-self: "center" + - font-weight: "bold" + - font-size: "23px" + name: + - align-self: "center" + - justify-self: "center" + - font-weight: "bold" + - font-size: "12px" + - filter: "opacity(40%)" + grid: + - grid-template-areas: "'l' 'n'" + - grid-template-columns: "auto" + - grid-template-rows: "min-content" + card: + - box-shadow: "none" + - padding-top: "15px" + - padding-botton: "10px" + - background-color: "rgba(var(--color-theme),0.05)" + - border-radius: "14px" + - place-self: "center" + - height: "80px" + item2: + card: + type: "custom:button-card" + color: "var(--google-blue)" + show_label: true + show_icon: false + name: "[[[ return variables.ulm_custom_card_irmajavi_speedtest_upload ]]]" + entity: >- + [[[ return + variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity; + ]]] + label: | + [[[ + var state1 = ""; + if (states[variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity].state){ + var state1 = states[variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity].state; + if (states[variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity].attributes.unit_of_measurement){ + state1 += states[variables.ulm_custom_card_irmajavi_speedtest_upload_speed_entity].attributes.unit_of_measurement; + } + } + return state1; + ]]] + styles: + icon: + - width: "30px" + - height: "30px" + label: + - align-self: "center" + - justify-self: "center" + - font-weight: "bold" + - font-size: "23px" + name: + - align-self: "center" + - justify-self: "center" + - font-weight: "bold" + - font-size: "12px" + - filter: "opacity(40%)" + grid: + - grid-template-areas: "'l' 'n'" + - grid-template-columns: "auto" + - grid-template-rows: "min-content" + card: + - box-shadow: "none" + - padding-top: "15px" + - padding-botton: "10px" + - background-color: "rgba(var(--color-theme),0.05)" + - border-radius: "14px" + - place-self: "center" + - height: "80px" diff --git a/custom_cards/custom_card_mpse_printer/custom_card_mpse_printer.yaml b/custom_cards/custom_card_mpse_printer/custom_card_mpse_printer.yaml new file mode 100644 index 000000000..3cf1542f1 --- /dev/null +++ b/custom_cards/custom_card_mpse_printer/custom_card_mpse_printer.yaml @@ -0,0 +1,220 @@ +--- +custom_card_mpse_printer: + show_icon: false + show_name: false + show_label: false + styles: + card: + - border-radius: "20px" + - box-shadow: "var(--box-shadow)" + - padding: "0px" + grid: + - grid-template-areas: "'item1' 'item2' 'item3' 'item4' 'item5'" + - grid-template-columns: "1fr" + - grid-template-rows: "min-content" + custom_fields: + item1: + card: + entity: "[[[ return entity.entity_id ]]]" + name: "[[[ return variables.ulm_card_printer_name ]]]" + label: >- + [[[ + return entity.state; + ]]] + template: + - "icon_info" + - "custom_card_mpse_printer_blue" + styles: + card: + - padding: "12px" + type: "custom:button-card" + item2: + card: + type: "custom:bar-card" + height: "20px" + positions: + name: off + value: "inside" + icon: off + indicator: off + minmax: off + color: "black" + entities: + - entity: "[[[ return variables.ulm_card_printer_black_name ]]]" + style: | + bar-card-currentbar{ + border: 0.01rem solid rgba(var(--color-theme),.4); + } + bar-card-backgroundbar{ + display: none; + } + bar-card-name{ + width: 2rem; + margin-right: 40px !important; + } + bar-card-value{ + width: 2rem; + margin-left: 40px !important; + justify-content: center; + display: flex; + color: grey; + } + bar-card-background{ + margin: 4px 0 4px 0 !important; + text-align: initial; + } + ha-card{ + --bar-card-border-radius: 5px; + border-radius: 0px; + box-shadow: none; + } + #states{ + padding: 0 16px; + } + item3: + card: + type: "custom:bar-card" + height: "20px" + positions: + name: off + value: "inside" + icon: off + indicator: off + minmax: off + color: "rgb(250,255,0)" + entities: + - entity: "[[[ return variables.ulm_card_printer_yellow_name ]]]" + style: | + bar-card-currentbar{ + border: 0.01rem solid rgba(var(--color-theme),.4); + } + bar-card-backgroundbar{ + display: none; + } + bar-card-name{ + width: 2rem; + margin-right: 40px !important; + } + bar-card-value{ + width: 2rem; + margin-left: 40px !important; + justify-content: center; + display: flex; + color: grey; + } + bar-card-background{ + margin: 4px 0 4px 0 !important; + text-align: initial; + } + ha-card{ + --bar-card-border-radius: 5px; + border-radius: 0px; + box-shadow: none; + } + #states{ + padding: 0 16px; + } + item4: + card: + type: "custom:bar-card" + height: "20px" + positions: + name: off + value: "inside" + icon: off + indicator: off + minmax: off + color: "rgb(248,0,255)" + entities: + - entity: "[[[ return variables.ulm_card_printer_magenta_name ]]]" + style: | + bar-card-currentbar{ + border: 0.01rem solid rgba(var(--color-theme),.4); + } + bar-card-backgroundbar{ + display: none; + } + bar-card-name{ + width: 2rem; + margin-right: 40px !important; + } + bar-card-value{ + width: 2rem; + margin-left: 40px !important; + justify-content: center; + display: flex; + color: grey; + } + bar-card-background{ + margin: 4px 0 4px 0 !important; + text-align: initial; + } + ha-card{ + --bar-card-border-radius: 5px; + border-radius: 0px; + box-shadow: none; + } + #states{ + padding: 0 16px; + } + item5: + card: + type: "custom:bar-card" + height: "20px" + positions: + name: off + value: "inside" + icon: off + indicator: off + minmax: off + color: "rgb(0,255,255)" + entities: + - entity: "[[[ return variables.ulm_card_printer_cyan_name ]]]" + style: | + bar-card-currentbar{ + border: 0.01rem solid rgba(var(--color-theme),.4); + } + bar-card-backgroundbar{ + display: none; + } + bar-card-name{ + width: 2rem; + margin-right: 40px !important; + } + bar-card-value{ + width: 2rem; + margin-left: 40px !important; + justify-content: center; + display: flex; + color: grey; + } + bar-card-background{ + margin: 4px 0 4px 0 !important; + text-align: initial; + } + ha-card{ + --bar-card-border-radius: 5px; + border-radius: 0px; + box-shadow: none; + } + #states{ + padding: 0 16px 16px 16px; + } +custom_card_mpse_printer_blue: + state: + - styles: + icon: + - color: "rgba(var(--color-blue),1)" + label: + - color: "rgba(var(--color-blue-text),1)" + name: + - color: "rgba(var(--color-blue-text),1)" + img_cell: + - background-color: "rgba(var(--color-blue), 0.2)" + card: + - background-color: "rgba(var(--color-background-blue), var(--opacity-bg))" + operator: "template" + value: > + [[[ + return entity.state!="idle" ? true : false + ]]] diff --git a/custom_cards/custom_card_paddy_dwd_pollen/custom_card_paddy_dwd_pollen.yaml b/custom_cards/custom_card_paddy_dwd_pollen/custom_card_paddy_dwd_pollen.yaml new file mode 100644 index 000000000..1fee063b8 --- /dev/null +++ b/custom_cards/custom_card_paddy_dwd_pollen/custom_card_paddy_dwd_pollen.yaml @@ -0,0 +1,69 @@ +--- +custom_card_paddy_dwd_pollen: + template: + - "card_generic_swap" + - "custom_card_paddy_dwd_pollen_language_variables" + variables: + ulm_card_generic_swap_name: "[[[ return variables.ulm_custom_card_paddy_dwd_pollen_name; ]]]" + ulm_card_generic_swap_icon: "[[[ return variables.ulm_custom_card_paddy_dwd_pollen_icon; ]]]" + custom_fields: + item1: + card: + type: "custom:button-card" + template: + - "icon_more_info" + custom_fields: + item1: + card: + type: "custom:button-card" + entity: "[[[ return entity.entity_id ]]]" + item2: + card: + type: "custom:button-card" + entity: "[[[ return entity.entity_id ]]]" + label: > + [[[ + if (entity.state == "6"){ + return variables.custom_card_paddy_dwd_pollen_6; + } else if (entity.state == "5"){ + return variables.custom_card_paddy_dwd_pollen_5; + } else if (entity.state == "4"){ + return variables.custom_card_paddy_dwd_pollen_4; + } else if (entity.state == "3"){ + return variables.custom_card_paddy_dwd_pollen_3; + } else if (entity.state == "2"){ + return variables.custom_card_paddy_dwd_pollen_2; + } else if (entity.state == "1"){ + return variables.custom_card_paddy_dwd_pollen_1; + } + return variables.custom_card_paddy_dwd_pollen_none; + ]]] + state: + - value: "6" + styles: + img_cell: + - background-color: "rgba(190,0,33,1)" + - value: "5" + styles: + img_cell: + - background-color: "rgba(240,56,26,1)" + - value: "4" + styles: + img_cell: + - background-color: "rgba(254,154,36,1)" + - value: "3" + styles: + img_cell: + - background-color: "rgba(254,197,77,1)" + - value: "2" + styles: + img_cell: + - background-color: "rgba(254,228,156,1)" + - value: "1" + styles: + img_cell: + - background-color: "rgba(219,250,200,1)" + - value: "0" + styles: + icon: + - color: "rgba(var(--color-theme),0.2)" diff --git a/custom_cards/custom_card_sisimomo_printer/custom_card_sisimomo_printer.yaml b/custom_cards/custom_card_sisimomo_printer/custom_card_sisimomo_printer.yaml new file mode 100644 index 000000000..30315c9f4 --- /dev/null +++ b/custom_cards/custom_card_sisimomo_printer/custom_card_sisimomo_printer.yaml @@ -0,0 +1,222 @@ +--- +custom_card_sisimomo_printer: + template: + - "ulm_translation_engine" + - "ulm_language_variables" + variables: + printer_name: "[[[ entity.attributes.friendly_name; ]]]" + ulm_idle: "idle" + show_icon: false + show_label: false + show_name: false + triggers_update: "all" + tap_action: + action: "" + styles: + grid: + - grid-template-areas: "'printer_state' 'cartridges'" + - grid-template-columns: "1fr" + - grid-template-rows: "min-content" + card: + - border-radius: "var(--border-radius)" + - box-shadow: "var(--box-shadow)" + - padding: "12px" + - "--mdc-ripple-press-opacity": 0 + - cursor: "default" + custom_fields: + printer_state: + card: + type: "custom:button-card" + template: | + [[[ + return ( + entity.state.toLowerCase() != variables.ulm_idle.toLowerCase() + && entity.state.toLowerCase() != variables.ulm_translation_unavailable.toLowerCase() + ? [ "icon_info", "blue_no_state" ] : [ "icon_info" ] + ); + ]]] + tap_action: + action: "more-info" + label: "[[[ return entity.state; ]]]" + name: "[[[ return variables.printer_name; ]]]" + entity: "[[[ return entity.entity_id; ]]]" + styles: + card: + - padding: "0" + - "--mdc-ripple-press-opacity": 0.12 + - cursor: "pointer" + label: + - text-transform: "capitalize" + cartridges: | + [[[ + // Source: https://stackoverflow.com/a/56266358 + const isColor = (strColor) => { + const s = new Option().style; + s.color = strColor; + return s.color !== ''; + } + + let toner_info_available = true; + if (variables.cartridges !== undefined ? Array.isArray(variables.cartridges) && variables.cartridges.length > 0 : false) { + let errorArray = []; + variables.cartridges.forEach(cartridge => { + let index = variables.cartridges.indexOf(cartridge); + let valid_cartridge_types = ['unicolor', 'tricolor'] + + // Confirm that the label is provided. + if (cartridge.label === undefined) { + errorArray.push(`cartridges.[${index}].label: You must provide a value.`); + } + + // Confirm that a valid cartridge type is provided, if not default to 'unicolor' + // for backwards compatibility with older configuration files + if (cartridge.type === undefined) { + cartridge.type = 'unicolor' + } else if (!valid_cartridge_types.includes(cartridge.type)) { + errorArray.push(`cartridges.[${index}].type: You must provide a valid cartridge type`); + } + + // Confirm that the color is provided and is valid color css. + if (cartridge.color !== undefined) { + if (cartridge.type === 'unicolor') { + if (typeof cartridge.color === 'string' || cartridge.color instanceof String ? !isColor(cartridge.color) : false) { + errorArray.push(`cartridges.[${index}].color: You must provide a single valid CSS color value.`); + } + } else if (Array.isArray(cartridge.color) && cartridge.color.length === 3 ? cartridge.type === 'tricolor' : false) { + cartridge.color.forEach(color => { + let col_index = cartridge.color.indexOf(color); + if (!isColor(String(color))) { + errorArray.push(`cartridges.[${index}].color.[${col_index}]: You must provide a single valid CSS color value.`); + } + }); + } else { + errorArray.push(`cartridges.[${index}].color: Invalid combination of colour and type.`); + } + } else { + errorArray.push(`cartridges.[${index}].color: You must provide a value.`); + } + + // Confirm that the entity_id is provided, is a valid entity_id, a integer and a value between 0 and 100 inclusively. + if (cartridge.entity_id === undefined) { + errorArray.push(`cartridges.[${index}].entity_id: You must provide a value.`); + } else if (states[cartridge.entity_id] === undefined) { + errorArray.push(`cartridges.[${index}].entity_id: You must provide a existing entity_id.`); + } else if (String(states[cartridge.entity_id].state).toLowerCase() === String(variables.ulm_translation_unavailable).toLowerCase()) { + toner_info_available = false; + } else if (isNaN(states[cartridge.entity_id].state) || typeof states[cartridge.entity_id].state === "boolean") { + errorArray.push(`cartridges.[${index}].entity_id: You must provide a entity representing an integer.`); + } else if (states[cartridge.entity_id].state < 0 || states[cartridge.entity_id].state > 100) { + errorArray.push(`cartridges.[${index}].entity_id: You must provide a entity representing an integer between 0 and 100 inclusively.`); + } + }); + if (errorArray.length > 0) { + return `
+ Configuration Error: + +
`; + } + + if (toner_info_available) { + return '
' + + variables.cartridges.map(cartridge => { + if (cartridge.type === "unicolor") { + cartridge.bar_style = ` + background-color: ${cartridge.color}; + width: ${states[cartridge.entity_id].state}%; + `; + } else if (cartridge.type === "tricolor") { + cartridge.bar_style = ` + background: linear-gradient( + 180deg, + ${cartridge.color[0]}, + ${cartridge.color[0]} 33%, + ${cartridge.color[1]} 33%, + ${cartridge.color[1]} 66%, + ${cartridge.color[2]} 66%, + ${cartridge.color[2]} + ); + width: ${states[cartridge.entity_id].state}%; + `; + } + + // Removes unnecessary whitespace from inline CSS + cartridge.bar_style = cartridge.bar_style.replace(/\s{2,}/g, '') + return ` +
${cartridge.label}
+
+
+
+
${states[cartridge.entity_id].state}%
+ `; + }).join("") + + '
'; + } else { + return ` +
+ Toner Information Unavailable +
+ `; + } + } else { + + } + ]]] + style: | + /* Cartridge CSS */ + div#cartridges .wrapper { + display: grid; + grid-template-columns: auto 1fr auto; + grid-gap: 1rem; + padding: 12px 8px 8px 8px; + } + div#cartridges .wrapper > *:nth-child(3n-2), .wrapper > *:nth-child(3n) { + place-self: center start; + } + div#cartridges .wrapper > .label { + filter: opacity(70%); + font-size: medium; + } + div#cartridges .wrapper > .container-bar { + position: relative; + border-radius: 4px; + border: 0.01rem solid rgba(var(--color-theme),.35); + } + div#cartridges .wrapper > .container-bar .bar { + height: 20px; + border-radius: 4px; + } + div#cartridges .wrapper > .state { + filter: opacity(40%); + font-size: medium; + } + + /* Error CSS */ + div#cartridges .error-container { + text-align: left; + font-size: 75%; + font-family: var(--code-font-family, monospace); + padding: 10px; + background-color: rgba(219, 68, 55, 0.75); + margin-top:10px; + border-radius:8px; + } + div#cartridges .error-container ul { + list-style: none; + padding: 0; + margin: 0; + overflow-wrap: break-word; + word-wrap: break-word; + white-space: normal !important; + } + div#cartridges .error-container ul li { + margin-top: 0.5em; + } + div#cartridges .info-unavailable { + padding: 1em; + white-space: normal; + margin-top:10px; + border-radius:8px; + opacity: 60%; + }