mirror of
https://github.com/home-assistant/core.git
synced 2026-08-26 16:14:38 +01:00
Bump pynordpool to 0.4.0 (#168130)
This commit is contained in:
@@ -108,11 +108,11 @@ class NordPoolDataUpdateCoordinator(DataUpdateCoordinator[DeliveryPeriodsData]):
|
||||
"""Fetch data from Nord Pool."""
|
||||
data = await self.api_call()
|
||||
if data and data.entries:
|
||||
current_day = dt_util.utcnow().strftime("%Y-%m-%d")
|
||||
for entry in data.entries:
|
||||
if entry.requested_date == current_day:
|
||||
LOGGER.debug("Data for current day found")
|
||||
return data
|
||||
current_day = dt_util.now().date()
|
||||
if current_day in data.entries:
|
||||
LOGGER.debug("Data for current day found")
|
||||
return data
|
||||
|
||||
if data and not data.entries and not initial:
|
||||
# Empty response, use cache
|
||||
LOGGER.debug("No data entries received")
|
||||
@@ -158,16 +158,11 @@ class NordPoolDataUpdateCoordinator(DataUpdateCoordinator[DeliveryPeriodsData]):
|
||||
def merge_price_entries(self) -> list[DeliveryPeriodEntry]:
|
||||
"""Return the merged price entries."""
|
||||
merged_entries: list[DeliveryPeriodEntry] = []
|
||||
for del_period in self.data.entries:
|
||||
for del_period in self.data.entries.values():
|
||||
merged_entries.extend(del_period.entries)
|
||||
return merged_entries
|
||||
|
||||
def get_data_current_day(self) -> DeliveryPeriodData:
|
||||
"""Return the current day data."""
|
||||
current_day = dt_util.utcnow().strftime("%Y-%m-%d")
|
||||
delivery_period: DeliveryPeriodData = self.data.entries[0]
|
||||
for del_period in self.data.entries:
|
||||
if del_period.requested_date == current_day:
|
||||
delivery_period = del_period
|
||||
break
|
||||
return delivery_period
|
||||
current_day = dt_util.now().date()
|
||||
return self.data.entries[current_day]
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["pynordpool"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["pynordpool==0.3.2"],
|
||||
"requirements": ["pynordpool==0.4.0"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -2326,7 +2326,7 @@ pynintendoparental==2.3.4
|
||||
pynobo==1.8.1
|
||||
|
||||
# homeassistant.components.nordpool
|
||||
pynordpool==0.3.2
|
||||
pynordpool==0.4.0
|
||||
|
||||
# homeassistant.components.nuki
|
||||
pynuki==1.6.3
|
||||
|
||||
Generated
+1
-1
@@ -1991,7 +1991,7 @@ pynintendoparental==2.3.4
|
||||
pynobo==1.8.1
|
||||
|
||||
# homeassistant.components.nordpool
|
||||
pynordpool==0.3.2
|
||||
pynordpool==0.4.0
|
||||
|
||||
# homeassistant.components.nuki
|
||||
pynuki==1.6.3
|
||||
|
||||
Reference in New Issue
Block a user