Normalize to kWh when handling WS energy/fossil_energy_consumption (#79649)

* Normalize to kWh when handling WS energy/fossil_energy_consumption

* Improve test
This commit is contained in:
Erik Montnemery 2022-10-05 16:27:08 +02:00 committed by GitHub
parent 312770dbac
commit 5d7756885b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -13,6 +13,7 @@ from typing import Any, cast
import voluptuous as vol
from homeassistant.components import recorder, websocket_api
from homeassistant.const import ENERGY_KILO_WATT_HOUR
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.integration_platform import (
async_process_integration_platforms,
@ -268,6 +269,7 @@ async def ws_get_fossil_energy_consumption(
statistic_ids,
"hour",
True,
{"energy": ENERGY_KILO_WATT_HOUR},
)
def _combine_sum_statistics(