Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
jugla committed Sep 25, 2022
2 parents 107264c + d9d85b6 commit 0ce8a4f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions custom_components/keyatome/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,12 @@ def _compute_period_usage(self, values, nb_of_day, ref_day, period_type):
(values["data"][-i]["consumption"]["bill1"]),
ROUND_PRICE,
)
_LOGGER.debug("%s : DETAILED value %s: %s", period_type, i, values["data"][-i])
_LOGGER.debug(
"%s : DETAILED value %s: %s", period_type, i, values["data"][-i]
)
except:
_LOGGER.debug("days %s does not exist ", -i)


self._periods_data.all_period[period_type].usage = current_period_consumption
self._periods_data.all_period[period_type].price = current_period_price
self._periods_data.all_period[period_type].ref_day = ref_day
Expand Down Expand Up @@ -1026,8 +1027,10 @@ def update_from_latest_data(self):
self._last_valid_period_data.usage,
)
# Take a margin to avoid storage of previous data
diff_period_day = new_period_data.ref_day - self._last_valid_period_data.ref_day
if diff_period_day > timedelta(seconds=1) :
diff_period_day = (
new_period_data.ref_day - self._last_valid_period_data.ref_day
)
if diff_period_day > timedelta(seconds=1):
_LOGGER.debug(
"Previous period %s becomes %s",
self._name,
Expand Down

0 comments on commit 0ce8a4f

Please sign in to comment.