mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Revert "Bump opower to 0.4.5 and use new account.id" (#117476)
This commit is contained in:
parent
e6296ae502
commit
bed31f302a
@ -86,7 +86,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
|||||||
# Because Opower provides historical usage/cost with a delay of a couple of days
|
# Because Opower provides historical usage/cost with a delay of a couple of days
|
||||||
# we need to insert data into statistics.
|
# we need to insert data into statistics.
|
||||||
await self._insert_statistics()
|
await self._insert_statistics()
|
||||||
return {forecast.account.id: forecast for forecast in forecasts}
|
return {forecast.account.utility_account_id: forecast for forecast in forecasts}
|
||||||
|
|
||||||
async def _insert_statistics(self) -> None:
|
async def _insert_statistics(self) -> None:
|
||||||
"""Insert Opower statistics."""
|
"""Insert Opower statistics."""
|
||||||
@ -97,7 +97,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
|||||||
account.meter_type.name.lower(),
|
account.meter_type.name.lower(),
|
||||||
# Some utilities like AEP have "-" in their account id.
|
# Some utilities like AEP have "-" in their account id.
|
||||||
# Replace it with "_" to avoid "Invalid statistic_id"
|
# Replace it with "_" to avoid "Invalid statistic_id"
|
||||||
account.id.replace("-", "_"),
|
account.utility_account_id.replace("-", "_"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
cost_statistic_id = f"{DOMAIN}:{id_prefix}_energy_cost"
|
cost_statistic_id = f"{DOMAIN}:{id_prefix}_energy_cost"
|
||||||
@ -161,7 +161,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
|||||||
|
|
||||||
name_prefix = (
|
name_prefix = (
|
||||||
f"Opower {self.api.utility.subdomain()} "
|
f"Opower {self.api.utility.subdomain()} "
|
||||||
f"{account.meter_type.name.lower()} {account.id}"
|
f"{account.meter_type.name.lower()} {account.utility_account_id}"
|
||||||
)
|
)
|
||||||
cost_metadata = StatisticMetaData(
|
cost_metadata = StatisticMetaData(
|
||||||
has_mean=False,
|
has_mean=False,
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/opower",
|
"documentation": "https://www.home-assistant.io/integrations/opower",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["opower"],
|
"loggers": ["opower"],
|
||||||
"requirements": ["opower==0.4.5"]
|
"requirements": ["opower==0.4.4"]
|
||||||
}
|
}
|
||||||
|
@ -159,10 +159,10 @@ async def async_setup_entry(
|
|||||||
entities: list[OpowerSensor] = []
|
entities: list[OpowerSensor] = []
|
||||||
forecasts = coordinator.data.values()
|
forecasts = coordinator.data.values()
|
||||||
for forecast in forecasts:
|
for forecast in forecasts:
|
||||||
device_id = f"{coordinator.api.utility.subdomain()}_{forecast.account.id}"
|
device_id = f"{coordinator.api.utility.subdomain()}_{forecast.account.utility_account_id}"
|
||||||
device = DeviceInfo(
|
device = DeviceInfo(
|
||||||
identifiers={(DOMAIN, device_id)},
|
identifiers={(DOMAIN, device_id)},
|
||||||
name=f"{forecast.account.meter_type.name} account {forecast.account.id}",
|
name=f"{forecast.account.meter_type.name} account {forecast.account.utility_account_id}",
|
||||||
manufacturer="Opower",
|
manufacturer="Opower",
|
||||||
model=coordinator.api.utility.name(),
|
model=coordinator.api.utility.name(),
|
||||||
entry_type=DeviceEntryType.SERVICE,
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
@ -182,7 +182,7 @@ async def async_setup_entry(
|
|||||||
OpowerSensor(
|
OpowerSensor(
|
||||||
coordinator,
|
coordinator,
|
||||||
sensor,
|
sensor,
|
||||||
forecast.account.id,
|
forecast.account.utility_account_id,
|
||||||
device,
|
device,
|
||||||
device_id,
|
device_id,
|
||||||
)
|
)
|
||||||
@ -201,7 +201,7 @@ class OpowerSensor(CoordinatorEntity[OpowerCoordinator], SensorEntity):
|
|||||||
self,
|
self,
|
||||||
coordinator: OpowerCoordinator,
|
coordinator: OpowerCoordinator,
|
||||||
description: OpowerEntityDescription,
|
description: OpowerEntityDescription,
|
||||||
id: str,
|
utility_account_id: str,
|
||||||
device: DeviceInfo,
|
device: DeviceInfo,
|
||||||
device_id: str,
|
device_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -210,11 +210,13 @@ class OpowerSensor(CoordinatorEntity[OpowerCoordinator], SensorEntity):
|
|||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_unique_id = f"{device_id}_{description.key}"
|
self._attr_unique_id = f"{device_id}_{description.key}"
|
||||||
self._attr_device_info = device
|
self._attr_device_info = device
|
||||||
self.id = id
|
self.utility_account_id = utility_account_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the state."""
|
"""Return the state."""
|
||||||
if self.coordinator.data is not None:
|
if self.coordinator.data is not None:
|
||||||
return self.entity_description.value_fn(self.coordinator.data[self.id])
|
return self.entity_description.value_fn(
|
||||||
|
self.coordinator.data[self.utility_account_id]
|
||||||
|
)
|
||||||
return None
|
return None
|
||||||
|
@ -1495,7 +1495,7 @@ openwrt-luci-rpc==1.1.17
|
|||||||
openwrt-ubus-rpc==0.0.2
|
openwrt-ubus-rpc==0.0.2
|
||||||
|
|
||||||
# homeassistant.components.opower
|
# homeassistant.components.opower
|
||||||
opower==0.4.5
|
opower==0.4.4
|
||||||
|
|
||||||
# homeassistant.components.oralb
|
# homeassistant.components.oralb
|
||||||
oralb-ble==0.17.6
|
oralb-ble==0.17.6
|
||||||
|
@ -1195,7 +1195,7 @@ openhomedevice==2.2.0
|
|||||||
openwebifpy==4.2.4
|
openwebifpy==4.2.4
|
||||||
|
|
||||||
# homeassistant.components.opower
|
# homeassistant.components.opower
|
||||||
opower==0.4.5
|
opower==0.4.4
|
||||||
|
|
||||||
# homeassistant.components.oralb
|
# homeassistant.components.oralb
|
||||||
oralb-ble==0.17.6
|
oralb-ble==0.17.6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user