-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,122 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
custom_cards/custom_card_bar_card/custom_card_bar_card.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
title: Lock Card Custom-card | ||
hide: | ||
- toc | ||
--- | ||
|
||
<!-- markdownlint-disable MD046 --> | ||
|
||
# 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. | ||
|
||
 | ||
|
||
## Credits | ||
|
||
Author: eraycetinay - 2022 | ||
Version: 0.0.3 | ||
|
||
## Changelog | ||
|
||
<details> | ||
<summary>0.0.3</summary> | ||
<ul> | ||
<h4>Contributor: <a href="https://github.com/sisimomo">Sisimomo</a> - 2022-06-14</h4> | ||
<li>Now can displays a warning when the battery is low.</li> | ||
<li>Now can displays a warning when the door is lock but the door is still open.</li> | ||
<li>Code refactoring to fit <a href="https://ui-lovelace-minimalist.github.io/UI/development/custom_cards/#order">framework structure</a>.</li> | ||
<li>Documentation clean up.</li> | ||
<li>Code clean up.</li> | ||
</ul> | ||
</details> | ||
<details> | ||
<summary>0.0.2</summary> | ||
Added option to only use lock.open | ||
</details> | ||
<details> | ||
<summary>0.0.1</summary> | ||
Initial release | ||
</details> | ||
|
||
## 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 | ||
<table> | ||
<tr> | ||
<th>Variable</th> | ||
<th>Example</th> | ||
<th>Default</th> | ||
<th>Required</th> | ||
<th>Explanation</th> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_tap_control</td> | ||
<td>true</td> | ||
<td>false</td> | ||
<td>no</td> | ||
<td>Lock/Unlock on tap action</td> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_only_open</td> | ||
<td>true</td> | ||
<td>false</td> | ||
<td>no</td> | ||
<td>Only use the card to open the door (always sends lock.open on tap)</td> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_battery_level</td> | ||
<td>sensor.door_battery</td> | ||
<td></td> | ||
<td>no</td> | ||
<td>Displays a warning when the battery is low.</td> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_battery_warning</td> | ||
<td>25</td> | ||
<td>20</td> | ||
<td>no</td> | ||
<td>At what battery percentage should the low battery warning appear.</td> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_battery_warning_low</td> | ||
<td>10</td> | ||
<td>5</td> | ||
<td>no</td> | ||
<td>At what battery percentage should the very low battery warning appear.</td> | ||
</tr> | ||
<tr> | ||
<td>ulm_custom_card_eraycetinay_lock_door_open</td> | ||
<td>binary_sensor.door_open</td> | ||
<td></td> | ||
<td>no</td> | ||
<td>Displays a warning when the door is lock but the door is still open.</td> | ||
</tr> | ||
</table> | ||
??? note "Template Code" | ||
```yaml title="custom_card_eraycetinay_lock.yaml" | ||
--8<-- "custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml" | ||
``` |
115 changes: 115 additions & 0 deletions
115
custom_cards/custom_card_eraycetinay_lock/custom_card_eraycetinay_lock.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 `<span title="${variables.ulm_custom_card_eraycetinay_lock_locked_and_opened}"><ha-icon icon="mdi:door-open" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon></span>`; | ||
} | ||
]]] | ||
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 `<span title="${variables.ulm_custom_card_eraycetinay_lock_battery_is_at} ${states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state}%"> | ||
<ha-icon icon="mdi:battery-low" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon> | ||
</span>`; | ||
} | ||
} | ||
]]] |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/de.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/en.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/es.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
11 changes: 11 additions & 0 deletions
11
custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
Oops, something went wrong.