Skip to content

Commit

Permalink
Fix charging text in secondary_info field #54
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwroc committed May 19, 2020
1 parent 40a1770 commit 7ff86de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "battery-state-card",
"version": "1.3.1",
"version": "1.3.2",
"description": "Battery State card for Home Assistant",
"main": "dist/battery-state-card.js",
"repository": {
Expand Down
8 changes: 6 additions & 2 deletions src/battery-vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,12 @@ class BatteryViewModel {
*/
private setSecondaryInfo(hass: HomeAssistant, entityData: HassEntity): string {
if (this.config.secondary_info) {
if (this.config.secondary_info == "charging" && this.charging) {
return this.config.charging_state?.secondary_info_text || "Charging"; // todo: think about i18n
if (this.config.secondary_info == "charging") {
if (this.charging) {
return this.config.charging_state?.secondary_info_text || "Charging"; // todo: think about i18n
}

return <any>null;
}
else {
const val = (<any>entityData)[this.config.secondary_info] || entityData.attributes[this.config.secondary_info] || this.config.secondary_info;
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HomeAssistant } from "./ha-types";

console.info(
"%c BATTERY-STATE-CARD %c 1.3.1",
"%c BATTERY-STATE-CARD %c 1.3.2",
"color: white; background: forestgreen; font-weight: 700;",
"color: forestgreen; background: white; font-weight: 700;",
);
Expand Down

0 comments on commit 7ff86de

Please sign in to comment.