Skip to content

Commit

Permalink
Merge pull request #208 from YorkshireIoT/194-entity-sensorsleep-from…
Browse files Browse the repository at this point in the history
…-integration-google_fit-has-state-class-total_increasing-but-its-state-is-negative

Check that sleep time is greater than awake time before subtracting
  • Loading branch information
YorkshireIoT authored Mar 2, 2024
2 parents 9f62a31 + 4df34bb commit 5191cd1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/google_fit/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def _get_session(activity_id: int) -> FitnessSessionResponse:
if (
self.fitness_data["sleepSeconds"] is not None
and self.fitness_data["awakeSeconds"] is not None
and self.fitness_data["sleepSeconds"]
>= self.fitness_data["awakeSeconds"]
):
self.fitness_data["sleepSeconds"] -= self.fitness_data[
"awakeSeconds"
Expand Down

0 comments on commit 5191cd1

Please sign in to comment.