From 57200b3ee72e38af5fc0ef1ae860210ab3779e02 Mon Sep 17 00:00:00 2001 From: sbabcock23 Date: Tue, 21 Jun 2022 08:20:30 -0500 Subject: [PATCH] updated units for sleep and nap measurements --- README.md | 2 ++ custom_components/tryfi/manifest.json | 2 +- custom_components/tryfi/sensor.py | 14 +++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6c8ebb..daa78cc 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ Turns on the collar light after dark if the pet is not home. * Enable possibility of if pet not home and not with owner then trigger lost dog mode # Version History +## 0.0.14 +* Fix - fixed sleep and nap units from hours to minutes with proper conversion ## 0.0.13 * Enhancement - Added Sleep and Nap "sensors"/attributes based on new version of pytryfi ## 0.0.12 diff --git a/custom_components/tryfi/manifest.json b/custom_components/tryfi/manifest.json index 2593c24..e4067be 100644 --- a/custom_components/tryfi/manifest.json +++ b/custom_components/tryfi/manifest.json @@ -1,7 +1,7 @@ { "domain": "tryfi", "name": "TryFi", - "version": "0.0.12", + "version": "0.0.14", "config_flow": true, "documentation": "https://github.com/sbabcock23/hass-tryfi", "issue_tracker": "https://github.com/sbabcock23/hass-tryfi/issues", diff --git a/custom_components/tryfi/sensor.py b/custom_components/tryfi/sensor.py index f7c2839..2aead77 100644 --- a/custom_components/tryfi/sensor.py +++ b/custom_components/tryfi/sensor.py @@ -5,7 +5,7 @@ DEVICE_CLASS_BATTERY, LENGTH_KILOMETERS, PERCENTAGE, - TIME_HOURS, + TIME_MINUTES, STATE_OK, STATE_PROBLEM, ) @@ -177,18 +177,18 @@ def state(self): return round(self.pet.monthlyTotalDistance / 1000, 2) elif self.statType.upper() == "NAP": if self.statTime.upper() == "DAILY": - return self.pet.dailyNap + return round(self.pet.dailyNap / 60, 2) elif self.statTime.upper() == "WEEKLY": - return self.pet.weeklyNap + return round(self.pet.weeklyNap / 60, 2) elif self.statTime.upper() == "MONTHLY": - return self.pet.monthlyNap + return round(self.pet.monthlyNap / 60, 2) elif self.statType.upper() == "SLEEP": if self.statTime.upper() == "DAILY": - return self.pet.dailySleep + return round(self.pet.dailySleep / 60, 2) elif self.statTime.upper() == "WEEKLY": - return self.pet.weeklySleep + return round(self.pet.weeklySleep / 60, 2) elif self.statTime.upper() == "MONTHLY": - return self.pet.monthlySleep + return round(self.pet.monthlySleep / 60, 2) else: return None