Skip to content

Commit

Permalink
Merge branch 'master' into feature/prepare-to-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Deev committed Aug 19, 2023
2 parents f3685b7 + 2b7fddc commit 3c39f5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 4 additions & 13 deletions custom_components/eyeonwater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except asyncio.TimeoutError as error:
raise ConfigEntryNotReady from error

try:
await eye_on_water_data.setup()
except Exception as e:
_LOGGER.exception(f"Fetching meters failed: {e}")
raise

# Fetch actual meter_info for all meters
try:
await eye_on_water_data.setup()
await eye_on_water_data.read_meters()
except Exception as e:
_LOGGER.error(f"Reading meters failed: {e}")
raise

# load old hostorical data
_LOGGER.info("Start loading historical data")
try:
await eye_on_water_data.import_historical_data(days_to_load=30)
except Exception as e:
_LOGGER.error(f"Loading historical data failed: {e}")
_LOGGER.info("Historical data loaded")


for meter in eye_on_water_data.meters:
_LOGGER.debug(meter.meter_uuid, meter.meter_id, meter.meter_info)
Expand Down Expand Up @@ -88,11 +81,9 @@ async def async_update_data():
DATA_SMART_METER: eye_on_water_data,
}

asyncio.create_task(coordinator.async_refresh())

_LOGGER.debug("Start setup platforms")
watch_task = asyncio.create_task(coordinator.async_refresh())
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
_LOGGER.debug("End setup platforms")

return True


Expand Down
1 change: 1 addition & 0 deletions custom_components/eyeonwater/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from homeassistant.helpers.update_coordinator import UpdateFailed

from .const import WATER_METER_NAME

from .eow import (
Account,
Client,
Expand Down

0 comments on commit 3c39f5f

Please sign in to comment.