Skip to content

Commit

Permalink
Merge pull request #24 from Codegnosis/develop
Browse files Browse the repository at this point in the history
Feature - Experimental DoD override
  • Loading branch information
Codegnosis authored Jan 22, 2024
2 parents cefbeb6 + d1b26b5 commit 6d92fef
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 371 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "givtcp-battery-card",
"version": "0.1.9",
"version": "0.2.0",
"description": "Lovelace card to display GivTCP battery info",
"private": true,
"type": "module",
Expand Down
7 changes: 7 additions & 0 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {
ICON_STATUS_CHARGING,
ICON_STATUS_DISCHARGING,
DISPLAY_BATTERY_RATES,
USE_CUSTOM_DOD,
CUSTOM_DOD,
CALCULATE_RESERVE_FROM_DOD, DISPLAY_CUSTOM_DOD_STATS,
} from "./constants";

export class ConfigUtils {
Expand All @@ -40,6 +43,10 @@ export class ConfigUtils {
icon_status_charging: ICON_STATUS_CHARGING,
icon_status_discharging: ICON_STATUS_DISCHARGING,
display_battery_rates: DISPLAY_BATTERY_RATES,
use_custom_dod: USE_CUSTOM_DOD,
custom_dod: CUSTOM_DOD,
calculate_reserve_from_dod: CALCULATE_RESERVE_FROM_DOD,
display_custom_dod_stats: DISPLAY_CUSTOM_DOD_STATS,
};
}

Expand Down
15 changes: 15 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,18 @@ export const ICON_STATUS_CHARGING = 'mdi:lightning-bolt';
export const ICON_STATUS_DISCHARGING = 'mdi:home-battery';

export const DISPLAY_BATTERY_RATES = true;

export const USE_CUSTOM_DOD = false;

export const CUSTOM_DOD = 100.0;

export const CALCULATE_RESERVE_FROM_DOD = false;

export const DISPLAY_CUSTOM_DOD_STATS = true;

export const DISPLAY_UNITS = {
W: "W",
KW: "kW",
WH: "Wh",
KWH: "kWh",
}
51 changes: 46 additions & 5 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
selector: {
number: {
min: 0,
max: 100
max: 100,
unit_of_measurement: "%",
}
}
},
Expand All @@ -65,7 +66,8 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
selector: {
number: {
min: 0,
max: 100
max: 100,
unit_of_measurement: "%",
}
}
},
Expand All @@ -84,7 +86,8 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
selector: {
number: {
min: 0,
max: 100
max: 100,
unit_of_measurement: "%",
}
}
},
Expand All @@ -103,7 +106,8 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
selector: {
number: {
min: 0,
max: 100
max: 100,
unit_of_measurement: "%",
}
}
},
Expand Down Expand Up @@ -133,7 +137,7 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
},
{
name: 'display_type',
label: 'Display type (0: Wh | 1: kWh | 2: Dynamic)',
label: 'Display type (0: Wh/W | 1: kWh/kW | 2: Dynamic)',
default: defaults.display_type,
selector: {
number: {
Expand Down Expand Up @@ -185,6 +189,43 @@ export class GivTCPBatteryCardEditor extends LitElement implements LovelaceCardE
boolean: {}
}
},
{
name: 'use_custom_dod',
label: 'EXPERIMENTAL! Use custom DoD to override GivTCP battery capacity value.',
default: defaults.use_custom_dod,
selector: {
boolean: {}
}
},
{
name: 'display_custom_dod_stats',
label: 'EXPERIMENTAL! Display the custom DOD stats',
default: defaults.display_custom_dod_stats,
selector: {
boolean: {}
}
},
{
name: 'custom_dod',
label: 'EXPERIMENTAL! Custom DoD as percentage to override GivTCP battery capacity value.',
default: defaults.custom_dod,
selector: {
number: {
min: 0,
max: 100,
step: "any",
unit_of_measurement: "%",
}
}
},
{
name: 'calculate_reserve_from_dod',
label: 'EXPERIMENTAL! Use custom DoD to calculate the battery reserve value',
default: defaults.calculate_reserve_from_dod,
selector: {
boolean: {}
}
},
];
}

Expand Down
Loading

0 comments on commit 6d92fef

Please sign in to comment.