Skip to content

Commit ed9c261

Browse files
Bump pynordpool to 0.4.0 (#168130)
1 parent 6a66d0a commit ed9c261

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

homeassistant/components/nordpool/coordinator.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ async def handle_data(self, initial: bool = False) -> DeliveryPeriodsData:
108108
"""Fetch data from Nord Pool."""
109109
data = await self.api_call()
110110
if data and data.entries:
111-
current_day = dt_util.utcnow().strftime("%Y-%m-%d")
112-
for entry in data.entries:
113-
if entry.requested_date == current_day:
114-
LOGGER.debug("Data for current day found")
115-
return data
111+
current_day = dt_util.now().date()
112+
if current_day in data.entries:
113+
LOGGER.debug("Data for current day found")
114+
return data
115+
116116
if data and not data.entries and not initial:
117117
# Empty response, use cache
118118
LOGGER.debug("No data entries received")
@@ -158,16 +158,11 @@ async def api_call(self, retry: int = 3) -> DeliveryPeriodsData | None:
158158
def merge_price_entries(self) -> list[DeliveryPeriodEntry]:
159159
"""Return the merged price entries."""
160160
merged_entries: list[DeliveryPeriodEntry] = []
161-
for del_period in self.data.entries:
161+
for del_period in self.data.entries.values():
162162
merged_entries.extend(del_period.entries)
163163
return merged_entries
164164

165165
def get_data_current_day(self) -> DeliveryPeriodData:
166166
"""Return the current day data."""
167-
current_day = dt_util.utcnow().strftime("%Y-%m-%d")
168-
delivery_period: DeliveryPeriodData = self.data.entries[0]
169-
for del_period in self.data.entries:
170-
if del_period.requested_date == current_day:
171-
delivery_period = del_period
172-
break
173-
return delivery_period
167+
current_day = dt_util.now().date()
168+
return self.data.entries[current_day]

homeassistant/components/nordpool/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"iot_class": "cloud_polling",
99
"loggers": ["pynordpool"],
1010
"quality_scale": "platinum",
11-
"requirements": ["pynordpool==0.3.2"],
11+
"requirements": ["pynordpool==0.4.0"],
1212
"single_config_entry": true
1313
}

requirements_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements_test_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)