mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix peco integration (#117165)
This commit is contained in:
parent
0a30032b96
commit
7efd547962
@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# Outage Counter Setup
|
# Outage Counter Setup
|
||||||
county: str = entry.data[CONF_COUNTY]
|
county: str = entry.data[CONF_COUNTY]
|
||||||
|
|
||||||
async def async_update_outage_data() -> OutageResults:
|
async def async_update_outage_data() -> PECOCoordinatorData:
|
||||||
"""Fetch data from API."""
|
"""Fetch data from API."""
|
||||||
try:
|
try:
|
||||||
outages: OutageResults = (
|
outages: OutageResults = (
|
||||||
@ -65,7 +65,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
raise UpdateFailed(f"Error parsing data: {err}") from err
|
raise UpdateFailed(f"Error parsing data: {err}") from err
|
||||||
return data
|
return data
|
||||||
|
|
||||||
coordinator = DataUpdateCoordinator(
|
outage_coordinator = DataUpdateCoordinator(
|
||||||
hass,
|
hass,
|
||||||
LOGGER,
|
LOGGER,
|
||||||
name="PECO Outage Count",
|
name="PECO Outage Count",
|
||||||
@ -73,9 +73,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
update_interval=timedelta(minutes=OUTAGE_SCAN_INTERVAL),
|
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):
|
if phone_number := entry.data.get(CONF_PHONE_NUMBER):
|
||||||
# Smart Meter Setup]
|
# Smart Meter Setup]
|
||||||
@ -92,7 +94,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
raise UpdateFailed(f"Error parsing data: {err}") from err
|
raise UpdateFailed(f"Error parsing data: {err}") from err
|
||||||
return data
|
return data
|
||||||
|
|
||||||
coordinator = DataUpdateCoordinator(
|
meter_coordinator = DataUpdateCoordinator(
|
||||||
hass,
|
hass,
|
||||||
LOGGER,
|
LOGGER,
|
||||||
name="PECO Smart Meter",
|
name="PECO Smart Meter",
|
||||||
@ -100,9 +102,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
update_interval=timedelta(minutes=SMART_METER_SCAN_INTERVAL),
|
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)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/peco",
|
"documentation": "https://www.home-assistant.io/integrations/peco",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["peco==0.0.29"]
|
"requirements": ["peco==0.0.30"]
|
||||||
}
|
}
|
||||||
|
@ -1543,7 +1543,7 @@ panasonic-viera==0.3.6
|
|||||||
pdunehd==1.3.2
|
pdunehd==1.3.2
|
||||||
|
|
||||||
# homeassistant.components.peco
|
# homeassistant.components.peco
|
||||||
peco==0.0.29
|
peco==0.0.30
|
||||||
|
|
||||||
# homeassistant.components.pencom
|
# homeassistant.components.pencom
|
||||||
pencompy==0.0.3
|
pencompy==0.0.3
|
||||||
|
@ -1240,7 +1240,7 @@ panasonic-viera==0.3.6
|
|||||||
pdunehd==1.3.2
|
pdunehd==1.3.2
|
||||||
|
|
||||||
# homeassistant.components.peco
|
# homeassistant.components.peco
|
||||||
peco==0.0.29
|
peco==0.0.30
|
||||||
|
|
||||||
# homeassistant.components.escea
|
# homeassistant.components.escea
|
||||||
pescea==1.0.12
|
pescea==1.0.12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user