Skip to content

Commit ad9100a

Browse files
authored
Update predbat-table-card.js
Add support for Alert Charging
1 parent d8e5839 commit ad9100a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

predbat-table-card.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ class PredbatTableCard extends HTMLElement {
481481
friendlyText = friendlyText.includes("NoCharge") ? friendlyText.replace('NoCharge','Charge to "limit"') : friendlyText.replace('Charge', 'Planned Charge');
482482
friendlyText = friendlyText.replace('Discharge', 'Planned Export'); //Discharge
483483
friendlyText = friendlyText.replace('Export', 'Planned Export'); //Discharge
484+
friendlyText = friendlyText.replace('Alert Charge', 'Planned Charge ⚠'); // Alert Charge
484485
}
485486

486487
if(this.config.use_friendly_states === true){
@@ -594,12 +595,15 @@ class PredbatTableCard extends HTMLElement {
594595
} else if(column === "state-column"){
595596

596597
// alert ⚠
598+
//theItem.value = "⚠Chrg↗";
599+
600+
newContent = theItem.value.replace(/[]/g, '').trim();
597601

598-
newContent = theItem.value.replace(/[]/g, '').trim();
599602
newContent = this.adjustStatusFields(newContent);
600603

601604
let additionalArrow = "";
602605
newCell.setAttribute('style', 'color: var(--energy-battery-out-color)');
606+
603607
if(theItem.value === "↘" || theItem.value === "↗" || theItem.value === "→"){
604608
let tooltip = "Running Normally";
605609
if(theItem.value.includes("ⅎ"))
@@ -630,13 +634,15 @@ class PredbatTableCard extends HTMLElement {
630634
// use force discharge icon
631635
additionalArrow = '<ha-icon icon="mdi:battery-lock" style="" title="Charging Paused"></ha-icon>';
632636
newCell.setAttribute('style', `color: ${theItem.color}`);
633-
} else if(newContent === "Charge"){
637+
} else if(newContent === "Charge" || newContent === "Alert Charge"){
634638
let tooltip = "Planned Charge";
635639

636640
if(theItem.value.includes("ⅎ"))
637641
tooltip = "Manual Forced Charge";
638642

639643
additionalArrow = `<ha-icon icon="mdi:battery-charging-100" title="${tooltip}" style="--mdc-icon-size: 22px;"></ha-icon>`;
644+
if(theItem.value.includes("⚠"))
645+
additionalArrow += `<ha-icon icon="mdi:alert-outline" title="${tooltip}" style="--mdc-icon-size: 18px;"></ha-icon>`;
640646
if(theItem.value.includes("ⅎ"))
641647
additionalArrow += `<ha-icon icon="mdi:hand-back-right-outline" title="${tooltip}" style="--mdc-icon-size: 22px;"></ha-icon>`;
642648
newCell.setAttribute('style', 'color: var(--energy-battery-in-color)');
@@ -788,6 +794,8 @@ class PredbatTableCard extends HTMLElement {
788794
newState = "Force Dischrg"
789795
if(status === "Chrg ⅎ")
790796
newState = "Force Charge"
797+
if(status === "⚠Chrg")
798+
newState = "Alert Charge"
791799
return newState;
792800
}
793801

0 commit comments

Comments
 (0)