mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
Include has_mean + has_sum in statistics metadata WS response (#68546)
* Include has_mean + has_sum in statistics metadata WS response * Don't include has_mean/has_sum in history/list_statistic_ids * Adjust tests * Do include has_mean/has_sum in history/list_statistic_ids
This commit is contained in:
@@ -753,7 +753,7 @@ def list_statistic_ids(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
statistic_ids: list[str] | tuple[str] | None = None,
|
statistic_ids: list[str] | tuple[str] | None = None,
|
||||||
statistic_type: Literal["mean"] | Literal["sum"] | None = None,
|
statistic_type: Literal["mean"] | Literal["sum"] | None = None,
|
||||||
) -> list[dict | None]:
|
) -> list[dict]:
|
||||||
"""Return all statistic_ids (or filtered one) and unit of measurement.
|
"""Return all statistic_ids (or filtered one) and unit of measurement.
|
||||||
|
|
||||||
Queries the database for existing statistic_ids, as well as integrations with
|
Queries the database for existing statistic_ids, as well as integrations with
|
||||||
@@ -777,6 +777,8 @@ def list_statistic_ids(
|
|||||||
|
|
||||||
result = {
|
result = {
|
||||||
meta["statistic_id"]: {
|
meta["statistic_id"]: {
|
||||||
|
"has_mean": meta["has_mean"],
|
||||||
|
"has_sum": meta["has_sum"],
|
||||||
"name": meta["name"],
|
"name": meta["name"],
|
||||||
"source": meta["source"],
|
"source": meta["source"],
|
||||||
"unit_of_measurement": meta["unit_of_measurement"],
|
"unit_of_measurement": meta["unit_of_measurement"],
|
||||||
@@ -805,6 +807,8 @@ def list_statistic_ids(
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"statistic_id": _id,
|
"statistic_id": _id,
|
||||||
|
"has_mean": info["has_mean"],
|
||||||
|
"has_sum": info["has_sum"],
|
||||||
"name": info.get("name"),
|
"name": info.get("name"),
|
||||||
"source": info["source"],
|
"source": info["source"],
|
||||||
"unit_of_measurement": info["unit_of_measurement"],
|
"unit_of_measurement": info["unit_of_measurement"],
|
||||||
|
@@ -627,6 +627,8 @@ def list_statistic_ids(
|
|||||||
|
|
||||||
if device_class not in UNIT_CONVERSIONS:
|
if device_class not in UNIT_CONVERSIONS:
|
||||||
result[state.entity_id] = {
|
result[state.entity_id] = {
|
||||||
|
"has_mean": "mean" in provided_statistics,
|
||||||
|
"has_sum": "sum" in provided_statistics,
|
||||||
"source": RECORDER_DOMAIN,
|
"source": RECORDER_DOMAIN,
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
}
|
}
|
||||||
@@ -637,6 +639,8 @@ def list_statistic_ids(
|
|||||||
|
|
||||||
statistics_unit = DEVICE_CLASS_UNITS[device_class]
|
statistics_unit = DEVICE_CLASS_UNITS[device_class]
|
||||||
result[state.entity_id] = {
|
result[state.entity_id] = {
|
||||||
|
"has_mean": "mean" in provided_statistics,
|
||||||
|
"has_sum": "sum" in provided_statistics,
|
||||||
"source": RECORDER_DOMAIN,
|
"source": RECORDER_DOMAIN,
|
||||||
"unit_of_measurement": statistics_unit,
|
"unit_of_measurement": statistics_unit,
|
||||||
}
|
}
|
||||||
|
@@ -57,12 +57,16 @@ async def test_demo_statistics(hass, recorder_mock):
|
|||||||
list_statistic_ids, hass
|
list_statistic_ids, hass
|
||||||
)
|
)
|
||||||
assert {
|
assert {
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "demo",
|
"source": "demo",
|
||||||
"statistic_id": "demo:temperature_outdoor",
|
"statistic_id": "demo:temperature_outdoor",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": "°C",
|
||||||
} in statistic_ids
|
} in statistic_ids
|
||||||
assert {
|
assert {
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "demo",
|
"source": "demo",
|
||||||
"statistic_id": "demo:energy_consumption",
|
"statistic_id": "demo:energy_consumption",
|
||||||
|
@@ -1038,6 +1038,8 @@ async def test_list_statistic_ids(hass, hass_ws_client, units, attributes, unit)
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": unit,
|
"unit_of_measurement": unit,
|
||||||
@@ -1056,6 +1058,8 @@ async def test_list_statistic_ids(hass, hass_ws_client, units, attributes, unit)
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": unit,
|
"unit_of_measurement": unit,
|
||||||
@@ -1076,6 +1080,8 @@ async def test_list_statistic_ids(hass, hass_ws_client, units, attributes, unit)
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": unit,
|
"unit_of_measurement": unit,
|
||||||
|
@@ -401,6 +401,8 @@ async def test_external_statistics(hass, hass_ws_client, caplog):
|
|||||||
statistic_ids = list_statistic_ids(hass)
|
statistic_ids = list_statistic_ids(hass)
|
||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"statistic_id": "test:total_energy_import",
|
"statistic_id": "test:total_energy_import",
|
||||||
"name": "Total imported energy",
|
"name": "Total imported energy",
|
||||||
"source": "test",
|
"source": "test",
|
||||||
|
@@ -230,6 +230,8 @@ async def test_update_statistics_metadata(hass, hass_ws_client, new_unit):
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "W",
|
"unit_of_measurement": "W",
|
||||||
@@ -254,6 +256,8 @@ async def test_update_statistics_metadata(hass, hass_ws_client, new_unit):
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": new_unit,
|
"unit_of_measurement": new_unit,
|
||||||
@@ -525,6 +529,8 @@ async def test_get_statistics_metadata(hass, hass_ws_client, units, attributes,
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": unit,
|
"unit_of_measurement": unit,
|
||||||
@@ -549,6 +555,8 @@ async def test_get_statistics_metadata(hass, hass_ws_client, units, attributes,
|
|||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test",
|
"statistic_id": "sensor.test",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": unit,
|
"unit_of_measurement": unit,
|
||||||
|
@@ -122,6 +122,8 @@ def test_compile_hourly_statistics(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -185,6 +187,8 @@ def test_compile_hourly_statistics_purged_state_changes(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -251,18 +255,24 @@ def test_compile_hourly_statistics_unsupported(hass_recorder, caplog, attributes
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": "°C",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test6",
|
"statistic_id": "sensor.test6",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": "°C",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test7",
|
"statistic_id": "sensor.test7",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": "°C",
|
||||||
@@ -386,6 +396,8 @@ async def test_compile_hourly_sum_statistics_amount(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": display_unit,
|
"unit_of_measurement": display_unit,
|
||||||
@@ -565,6 +577,8 @@ def test_compile_hourly_sum_statistics_amount_reset_every_state_change(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -654,6 +668,8 @@ def test_compile_hourly_sum_statistics_amount_invalid_last_reset(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -727,6 +743,8 @@ def test_compile_hourly_sum_statistics_nan_inf_state(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -837,6 +855,8 @@ def test_compile_hourly_sum_statistics_negative_state(
|
|||||||
statistic_ids = list_statistic_ids(hass)
|
statistic_ids = list_statistic_ids(hass)
|
||||||
assert {
|
assert {
|
||||||
"name": None,
|
"name": None,
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"statistic_id": entity_id,
|
"statistic_id": entity_id,
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -914,6 +934,8 @@ def test_compile_hourly_sum_statistics_total_no_reset(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1006,6 +1028,8 @@ def test_compile_hourly_sum_statistics_total_increasing(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1109,6 +1133,8 @@ def test_compile_hourly_sum_statistics_total_increasing_small_dip(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1200,6 +1226,8 @@ def test_compile_hourly_energy_statistics_unsupported(hass_recorder, caplog):
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "kWh",
|
"unit_of_measurement": "kWh",
|
||||||
@@ -1289,18 +1317,24 @@ def test_compile_hourly_energy_statistics_multiple(hass_recorder, caplog):
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "kWh",
|
"unit_of_measurement": "kWh",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test2",
|
"statistic_id": "sensor.test2",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "kWh",
|
"unit_of_measurement": "kWh",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test3",
|
"statistic_id": "sensor.test3",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "kWh",
|
"unit_of_measurement": "kWh",
|
||||||
@@ -1622,6 +1656,8 @@ def test_list_statistic_ids(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": statistic_type == "mean",
|
||||||
|
"has_sum": statistic_type == "sum",
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1633,6 +1669,8 @@ def test_list_statistic_ids(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": statistic_type == "mean",
|
||||||
|
"has_sum": statistic_type == "sum",
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1710,6 +1748,8 @@ def test_compile_hourly_statistics_changing_units_1(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1742,6 +1782,8 @@ def test_compile_hourly_statistics_changing_units_1(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1805,6 +1847,8 @@ def test_compile_hourly_statistics_changing_units_2(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "cats",
|
"unit_of_measurement": "cats",
|
||||||
@@ -1858,6 +1902,8 @@ def test_compile_hourly_statistics_changing_units_3(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1888,6 +1934,8 @@ def test_compile_hourly_statistics_changing_units_3(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": native_unit,
|
"unit_of_measurement": native_unit,
|
||||||
@@ -1941,6 +1989,8 @@ def test_compile_hourly_statistics_changing_device_class_1(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": state_unit,
|
"unit_of_measurement": state_unit,
|
||||||
@@ -1987,6 +2037,8 @@ def test_compile_hourly_statistics_changing_device_class_1(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": state_unit,
|
"unit_of_measurement": state_unit,
|
||||||
@@ -2041,6 +2093,8 @@ def test_compile_hourly_statistics_changing_device_class_2(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": statistic_unit,
|
"unit_of_measurement": statistic_unit,
|
||||||
@@ -2087,6 +2141,8 @@ def test_compile_hourly_statistics_changing_device_class_2(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": statistic_unit,
|
"unit_of_measurement": statistic_unit,
|
||||||
@@ -2144,6 +2200,8 @@ def test_compile_hourly_statistics_changing_statistics(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": None,
|
"unit_of_measurement": None,
|
||||||
@@ -2176,6 +2234,8 @@ def test_compile_hourly_statistics_changing_statistics(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": None,
|
"unit_of_measurement": None,
|
||||||
@@ -2372,24 +2432,32 @@ def test_compile_statistics_hourly_daily_monthly_summary(
|
|||||||
assert statistic_ids == [
|
assert statistic_ids == [
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test1",
|
"statistic_id": "sensor.test1",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "%",
|
"unit_of_measurement": "%",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test2",
|
"statistic_id": "sensor.test2",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "%",
|
"unit_of_measurement": "%",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test3",
|
"statistic_id": "sensor.test3",
|
||||||
|
"has_mean": True,
|
||||||
|
"has_sum": False,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "%",
|
"unit_of_measurement": "%",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"statistic_id": "sensor.test4",
|
"statistic_id": "sensor.test4",
|
||||||
|
"has_mean": False,
|
||||||
|
"has_sum": True,
|
||||||
"name": None,
|
"name": None,
|
||||||
"source": "recorder",
|
"source": "recorder",
|
||||||
"unit_of_measurement": "EUR",
|
"unit_of_measurement": "EUR",
|
||||||
|
Reference in New Issue
Block a user