Skip to content

Commit

Permalink
Merge pull request #1500 from downey-lv/lock_update
Browse files Browse the repository at this point in the history
Fix custom_card_eraycetinay_lock translations and add support for binary sensor
  • Loading branch information
basbruss authored Jul 3, 2024
2 parents 77424a7 + 4517bec commit a6a8cab
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 56 deletions.
14 changes: 14 additions & 0 deletions custom_cards/custom_card_eraycetinay_lock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ Version: 0.0.3
<td>no</td>
<td>Displays a warning when the door is lock but the door is still open.</td>
</tr>
<tr>
<td>ulm_custom_card_eraycetinay_lock_battery_sensor_binary</td>
<td>true</td>
<td>false</td>
<td>no</td>
<td>Set to true if using a binary battery sensor. Will ignore battery_warning percentage settings</td>
</tr>
<tr>
<td>ulm_custom_card_eraycetinay_lock_battery_sensor_binary_low_state</td>
<td>off</td>
<td>on</td>
<td>no</td>
<td>Set whether the binary sensor turns to on or off when in low state</td>
</tr>
</table>
??? note "Template Code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ custom_card_eraycetinay_lock:
variables:
ulm_custom_card_eraycetinay_lock_battery_warning: 20
ulm_custom_card_eraycetinay_lock_battery_warning_low: 5
ulm_custom_card_eraycetinay_lock_battery_sensor_binary: false
ulm_custom_card_eraycetinay_lock_battery_sensor_binary_low_state: "on"
tap_action:
action: |
[[[
Expand Down Expand Up @@ -89,10 +91,16 @@ custom_card_eraycetinay_lock:
- 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)";
if (variables.ulm_custom_card_eraycetinay_lock_battery_sensor_binary) {
if (states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state == variables.ulm_custom_card_eraycetinay_lock_battery_sensor_binary_low_state) {
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_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)";
}
}
}
]]]
Expand All @@ -106,10 +114,18 @@ custom_card_eraycetinay_lock:
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>`;
if (variables.ulm_custom_card_eraycetinay_lock_battery_sensor_binary) {
if (states[variables.ulm_custom_card_eraycetinay_lock_battery_level].state == variables.ulm_custom_card_eraycetinay_lock_battery_sensor_binary_low_state) {
return `<span title="${variables.ulm_custom_card_eraycetinay_lock_battery_is_low}">
<ha-icon icon="mdi:battery-low" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon>
</span>`;
}
} else {
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>`;
}
}
}
]]]
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/de.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "verriegelt"
ulm_custom_card_eraycetinay_lock_unlocked: "entriegelt"
ulm_custom_card_eraycetinay_lock_locking: "verriegeln"
ulm_custom_card_eraycetinay_lock_unlocking: "entriegeln"
ulm_custom_card_eraycetinay_lock_unavailable: "nicht verfügbar"
ulm_custom_card_eraycetinay_lock_jammed: "blockiert"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "Die Tür ist verschlossen, aber noch offen."
ulm_custom_card_eraycetinay_lock_battery_is_at: "Batterie ist an"
ulm_custom_card_eraycetinay_lock_battery_is_low: "Batterie schwach"
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/en.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "locked"
ulm_custom_card_eraycetinay_lock_unlocked: "unlocked"
ulm_custom_card_eraycetinay_lock_locking: "locking"
ulm_custom_card_eraycetinay_lock_unlocking: "unlocking"
ulm_custom_card_eraycetinay_lock_unavailable: "unavailable"
ulm_custom_card_eraycetinay_lock_jammed: "jammed"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "The door is locked but still open."
ulm_custom_card_eraycetinay_lock_battery_is_at: "Battery is at"
ulm_custom_card_eraycetinay_lock_battery_is_low: "Battery is low"
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/es.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "bloqueado"
ulm_custom_card_eraycetinay_lock_unlocked: "desbloqueado"
ulm_custom_card_eraycetinay_lock_locking: "bloqueando"
ulm_custom_card_eraycetinay_lock_unlocking: "desbloqueando"
ulm_custom_card_eraycetinay_lock_unavailable: "no disponible"
ulm_custom_card_eraycetinay_lock_jammed: "apretada"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "La puerta está cerrada pero aún abierta."
ulm_custom_card_eraycetinay_lock_battery_is_at: "la batería está en"
ulm_custom_card_eraycetinay_lock_battery_is_low: "La batería está baja"
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/pl.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "zamknięty"
ulm_custom_card_eraycetinay_lock_unlocked: "otwarty"
ulm_custom_card_eraycetinay_lock_locking: "zamykanie"
ulm_custom_card_eraycetinay_lock_unlocking: "otwieranie"
ulm_custom_card_eraycetinay_lock_unavailable: "niedostępny"
ulm_custom_card_eraycetinay_lock_jammed: "zacięty"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "Drzwi są zamknięte, ale nadal otwarte."
ulm_custom_card_eraycetinay_lock_battery_is_at: "Bateria jest na"
ulm_custom_card_eraycetinay_lock_battery_is_low: "Bateria jest słaba"
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/sv.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "låst"
ulm_custom_card_eraycetinay_lock_unlocked: "olåst"
ulm_custom_card_eraycetinay_lock_locking: "låser"
ulm_custom_card_eraycetinay_lock_unlocking: "låser upp"
ulm_custom_card_eraycetinay_lock_unavailable: "otillgängligt"
ulm_custom_card_eraycetinay_lock_jammed: "fastnat"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "Dörren är låst men fortfarande öppen."
ulm_custom_card_eraycetinay_lock_battery_is_at: "Batterinivån är"
ulm_custom_card_eraycetinay_lock_battery_is_low: "Batteriet är lågt"
17 changes: 9 additions & 8 deletions custom_cards/custom_card_eraycetinay_lock/languages/tr.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
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"
ulm_custom_card_eraycetinay_lock_locked: "kilitli"
ulm_custom_card_eraycetinay_lock_unlocked: "kilitli değil"
ulm_custom_card_eraycetinay_lock_locking: "kilitleniyor"
ulm_custom_card_eraycetinay_lock_unlocking: "kilit açılıyor"
ulm_custom_card_eraycetinay_lock_unavailable: "müsait değil"
ulm_custom_card_eraycetinay_lock_jammed: "sıkışmış"
ulm_custom_card_eraycetinay_lock_locked_and_opened: "Kapı kilitli ama hala açık"
ulm_custom_card_eraycetinay_lock_battery_is_at: "pil"
ulm_custom_card_eraycetinay_lock_battery_is_low: "pil zayıf"

0 comments on commit a6a8cab

Please sign in to comment.