Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hombach authored and Hombach committed Nov 9, 2024
1 parent af80d1b commit 3d5249c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ If you enjoyed this project — or just feeling generous, consider buying me a b
### 0.4.0 (2024-11-xx) WiP

- (hombach) implement managed charging time (#29)
- (hombach) fixed error in 'time to finish charge'

### 0.3.0 (2024-11-08)

Expand Down
7 changes: 6 additions & 1 deletion build/lib/teslafiAPICaller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/lib/teslafiAPICaller.js.map

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/lib/teslafiAPICaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,15 @@ export class TeslaFiAPICaller extends ProjectUtils {
stVD.time_to_full_charge.desc,
"h",
);
this.checkAndSetValue(
`battery-state.time_to_finish_charge`,
calculateEndTimeFromNow(parseFloat(stVD.time_to_full_charge.value)),
stVD.time_to_full_charge.desc,
);
if (parseFloat(stVD.time_to_full_charge.value) != 0) {
this.checkAndSetValue(
`battery-state.time_to_finish_charge`,
calculateEndTimeFromNow(parseFloat(stVD.time_to_full_charge.value)),
stVD.time_to_full_charge.desc,
);
} else {
this.checkAndSetValue(`battery-state.time_to_finish_charge`, `---`, stVD.time_to_full_charge.desc);
}
} else {
this.checkAndSetValueNumber(`battery-state.${stVD.time_to_full_charge.key}`, 0, stVD.time_to_full_charge.desc);
this.checkAndSetValue(`battery-state.time_to_finish_charge`, `---`, stVD.time_to_full_charge.desc);
Expand Down

0 comments on commit 3d5249c

Please sign in to comment.