Skip to content

Commit

Permalink
Fix peco integration (home-assistant#117165)
Browse files Browse the repository at this point in the history
  • Loading branch information
IceBotYT authored Jun 22, 2024
1 parent 0a30032 commit 7efd547
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions homeassistant/components/peco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# Outage Counter Setup
county: str = entry.data[CONF_COUNTY]

async def async_update_outage_data() -> OutageResults:
async def async_update_outage_data() -> PECOCoordinatorData:
"""Fetch data from API."""
try:
outages: OutageResults = (
Expand All @@ -65,17 +65,19 @@ async def async_update_outage_data() -> OutageResults:
raise UpdateFailed(f"Error parsing data: {err}") from err
return data

coordinator = DataUpdateCoordinator(
outage_coordinator = DataUpdateCoordinator(
hass,
LOGGER,
name="PECO Outage Count",
update_method=async_update_outage_data,
update_interval=timedelta(minutes=OUTAGE_SCAN_INTERVAL),
)

await coordinator.async_config_entry_first_refresh()
await outage_coordinator.async_config_entry_first_refresh()

hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {"outage_count": coordinator}
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
"outage_count": outage_coordinator
}

if phone_number := entry.data.get(CONF_PHONE_NUMBER):
# Smart Meter Setup]
Expand All @@ -92,17 +94,17 @@ async def async_update_meter_data() -> bool:
raise UpdateFailed(f"Error parsing data: {err}") from err
return data

coordinator = DataUpdateCoordinator(
meter_coordinator = DataUpdateCoordinator(
hass,
LOGGER,
name="PECO Smart Meter",
update_method=async_update_meter_data,
update_interval=timedelta(minutes=SMART_METER_SCAN_INTERVAL),
)

await coordinator.async_config_entry_first_refresh()
await meter_coordinator.async_config_entry_first_refresh()

hass.data[DOMAIN][entry.entry_id]["smart_meter"] = coordinator
hass.data[DOMAIN][entry.entry_id]["smart_meter"] = meter_coordinator

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/peco/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/peco",
"iot_class": "cloud_polling",
"requirements": ["peco==0.0.29"]
"requirements": ["peco==0.0.30"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ panasonic-viera==0.3.6
pdunehd==1.3.2

# homeassistant.components.peco
peco==0.0.29
peco==0.0.30

# homeassistant.components.pencom
pencompy==0.0.3
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ panasonic-viera==0.3.6
pdunehd==1.3.2

# homeassistant.components.peco
peco==0.0.29
peco==0.0.30

# homeassistant.components.escea
pescea==1.0.12
Expand Down

0 comments on commit 7efd547

Please sign in to comment.