From 67ad348176299a8f75c6c629c1d45b739640b488 Mon Sep 17 00:00:00 2001 From: magnuselden Date: Thu, 23 Jun 2022 10:13:56 +0200 Subject: [PATCH] #124 and bump 1.2.1 --- custom_components/peaqev/__init__.py | 5 ++++- custom_components/peaqev/manifest.json | 2 +- custom_components/peaqev/peaqservice/hub/hub.py | 2 +- custom_components/peaqev/peaqservice/hub/hub_lite.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/custom_components/peaqev/__init__.py b/custom_components/peaqev/__init__.py index 2b23e979..200863ec 100644 --- a/custom_components/peaqev/__init__.py +++ b/custom_components/peaqev/__init__.py @@ -72,7 +72,10 @@ async def servicehandler_disable(call): # pylint:disable=unused-argument ATTR_HOURS = "hours" async def servicehandler_override_nonhours(call): # pylint:disable=unused-argument - hours = call.data.get(ATTR_HOURS) + try: + hours = call.data.get(ATTR_HOURS) + except: + hours = 1 await hub.call_override_nonhours(hours) hass.services.async_register(DOMAIN, "enable", servicehandler_enable) diff --git a/custom_components/peaqev/manifest.json b/custom_components/peaqev/manifest.json index e5c62ca0..1f62ccd4 100644 --- a/custom_components/peaqev/manifest.json +++ b/custom_components/peaqev/manifest.json @@ -10,7 +10,7 @@ "codeowners": [ "@elden1337" ], - "version": "1.2.0", + "version": "1.2.1", "iot_class": "calculated", "dependencies": [ "recorder", diff --git a/custom_components/peaqev/peaqservice/hub/hub.py b/custom_components/peaqev/peaqservice/hub/hub.py index 15c71038..e0a90ff9 100644 --- a/custom_components/peaqev/peaqservice/hub/hub.py +++ b/custom_components/peaqev/peaqservice/hub/hub.py @@ -88,7 +88,7 @@ def is_initialized(self) -> bool: @property def current_peak_dynamic(self): if self.price_aware is True and len(self.hours.dynamic_caution_hours): - if datetime.now().hour in self.hours.dynamic_caution_hours.keys(): + if datetime.now().hour in self.hours.dynamic_caution_hours.keys() and self.timer.is_override is False: return self.currentpeak.value * self.hours.dynamic_caution_hours[datetime.now().hour] return self.currentpeak.value diff --git a/custom_components/peaqev/peaqservice/hub/hub_lite.py b/custom_components/peaqev/peaqservice/hub/hub_lite.py index f97976f6..7971acea 100644 --- a/custom_components/peaqev/peaqservice/hub/hub_lite.py +++ b/custom_components/peaqev/peaqservice/hub/hub_lite.py @@ -63,7 +63,7 @@ def is_initialized(self) -> bool: @property def current_peak_dynamic(self): if self.price_aware is True and len(self.hours.dynamic_caution_hours): - if datetime.now().hour in self.hours.dynamic_caution_hours.keys(): + if datetime.now().hour in self.hours.dynamic_caution_hours.keys() and self.timer.is_override is False: return self.currentpeak.value * self.hours.dynamic_caution_hours[datetime.now().hour] return self.currentpeak.value