Skip to content

Commit

Permalink
remove test code
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeyev committed Jun 25, 2024
1 parent 0e79689 commit 70982d6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions custom_components/eyeonwater/statistic_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from homeassistant.components.recorder.models import StatisticData, StatisticMetaData
from homeassistant.components.recorder.statistics import get_last_statistics
from homeassistant.const import UnitOfVolume
from homeassistant.core import valid_entity_id
from homeassistant.util import dt as dtutil
from pyonwater import DataPoint, Meter

Expand Down Expand Up @@ -61,11 +60,7 @@ def get_statistics_id(meter_id: str) -> str:
def get_statistic_metadata(meter: Meter) -> StatisticMetaData:
"""Build statistic metadata for a given meter."""
name = get_statistic_name(meter_id=meter.meter_id)
statistic_id = get_statistics_id(meter.meter_id) # if should be meter id

if not valid_entity_id(statistic_id):
msg = "Invalid statistic_id {statistic_id} for meter {meter.meter_id}"
raise Exception(msg) # noqa: TRY002
statistic_id = get_statistics_id(meter.meter_id)

return StatisticMetaData(
has_mean=False,
Expand Down Expand Up @@ -98,7 +93,7 @@ async def get_last_imported_time(
"""Return last imported data datetime."""
# https://github.com/home-assistant/core/blob/74e2d5c5c312cf3ba154b5206ceb19ba884c6fb4/homeassistant/components/tibber/sensor.py#L11

statistic_id = get_statistics_id(meter.meter_id) # if should be meter id
statistic_id = get_statistics_id(meter.meter_id)
last_stats = await get_instance(hass).async_add_executor_job(
get_last_statistics,
hass,
Expand Down

0 comments on commit 70982d6

Please sign in to comment.