From 1aa3544036a465f801ce6632043b9758b8a7dc4d Mon Sep 17 00:00:00 2001 From: disforw Date: Thu, 17 Aug 2023 20:18:28 -0400 Subject: [PATCH 1/2] Update __init__.py - code cleanup --- custom_components/eyeonwater/__init__.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/custom_components/eyeonwater/__init__.py b/custom_components/eyeonwater/__init__.py index f2c64f7..5cdb0a9 100644 --- a/custom_components/eyeonwater/__init__.py +++ b/custom_components/eyeonwater/__init__.py @@ -40,24 +40,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: await eye_on_water_data.setup() - except Exception as e: - _LOGGER.error(f"Fetching meters failed: {e}") - raise e - - # Fetch actual meter_info for all meters - try: await eye_on_water_data.read_meters() except Exception as e: _LOGGER.error(f"Reading meters failed: {e}") raise e - # 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) @@ -86,10 +78,8 @@ async def async_update_data(): } watch_task = asyncio.create_task(coordinator.async_refresh()) - - _LOGGER.debug("Start setup platforms") await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - _LOGGER.debug("End setup platforms") + return True From 2b7fddc8e6e597f53ebb43ae69e11ebd3e45a377 Mon Sep 17 00:00:00 2001 From: disforw Date: Thu, 17 Aug 2023 20:24:39 -0400 Subject: [PATCH 2/2] Update coordinator.py - code cleanup --- custom_components/eyeonwater/coordinator.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/custom_components/eyeonwater/coordinator.py b/custom_components/eyeonwater/coordinator.py index 71ceb07..61da82a 100644 --- a/custom_components/eyeonwater/coordinator.py +++ b/custom_components/eyeonwater/coordinator.py @@ -12,7 +12,6 @@ from .const import WATER_METER_NAME - from .config_flow import create_account_from_config from .eow import ( Account, @@ -100,9 +99,6 @@ async def get_historical_data( statistics = [] for date in date_list: - _LOGGER.debug( - f"requesting historical statistics for {meter.meter_id} on {date} with units {units}" - ) try: data = await meter.get_historical_data( date=date, units=units, client=self.client