mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Fix Invalid statistic_id for Opower: National Grid (#144243)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
parent
58906008b9
commit
66b2e06cd3
@ -113,14 +113,16 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
||||
_LOGGER.error("Error getting accounts: %s", err)
|
||||
raise
|
||||
for account in accounts:
|
||||
id_prefix = "_".join(
|
||||
id_prefix = (
|
||||
(
|
||||
self.api.utility.subdomain(),
|
||||
account.meter_type.name.lower(),
|
||||
# Some utilities like AEP have "-" in their account id.
|
||||
# Replace it with "_" to avoid "Invalid statistic_id"
|
||||
account.utility_account_id.replace("-", "_").lower(),
|
||||
f"{self.api.utility.subdomain()}_{account.meter_type.name}_"
|
||||
f"{account.utility_account_id}"
|
||||
)
|
||||
# Some utilities like AEP have "-" in their account id.
|
||||
# Other utilities like ngny-gas have "-" in their subdomain.
|
||||
# Replace it with "_" to avoid "Invalid statistic_id"
|
||||
.replace("-", "_")
|
||||
.lower()
|
||||
)
|
||||
cost_statistic_id = f"{DOMAIN}:{id_prefix}_energy_cost"
|
||||
compensation_statistic_id = f"{DOMAIN}:{id_prefix}_energy_compensation"
|
||||
|
Loading…
x
Reference in New Issue
Block a user