Skip to content

Commit

Permalink
Use external pyonwater library (#45)
Browse files Browse the repository at this point in the history
* use external pyonwater library

* pun pre-commit

---------

Co-authored-by: Konstantin Deev <konstantinde@zillowgroup.com>
  • Loading branch information
kdeyev and Konstantin Deev authored Aug 23, 2023
1 parent 81dffbb commit 7d44b74
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 426 deletions.
3 changes: 2 additions & 1 deletion custom_components/eyeonwater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import asyncio
import logging

from pyonwater import EyeOnWaterAuthError

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
Expand All @@ -18,7 +20,6 @@
SCAN_INTERVAL,
)
from .coordinator import EyeOnWaterData
from .eow import EyeOnWaterAuthError

_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.StreamHandler())
Expand Down
3 changes: 2 additions & 1 deletion custom_components/eyeonwater/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Support for EyeOnWater binary sensors."""
from pyonwater import Meter

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
Expand All @@ -13,7 +15,6 @@
)

from .const import DATA_COORDINATOR, DATA_SMART_METER, DOMAIN
from .eow import Meter

FLAG_SENSORS = [
BinarySensorEntityDescription(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eyeonwater/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any

from aiohttp import ClientError
from pyonwater import Account, Client, EyeOnWaterAPIError, EyeOnWaterAuthError
import voluptuous as vol

from homeassistant import config_entries, core, exceptions
Expand All @@ -12,7 +13,6 @@
from homeassistant.util.unit_system import METRIC_SYSTEM

from .const import DOMAIN
from .eow import Account, Client, EyeOnWaterAPIError, EyeOnWaterAuthError

CONF_EOW_HOSTNAME_COM = "eyeonwater.com"
CONF_EOW_HOSTNAME_CA = "eyeonwater.ca"
Expand Down
17 changes: 9 additions & 8 deletions custom_components/eyeonwater/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
import logging
from typing import List

from pyonwater import (
Account,
Client,
EyeOnWaterAPIError,
EyeOnWaterAuthError,
EyeOnWaterResponseIsEmpty,
Meter,
)

from homeassistant.components.recorder.models import StatisticData, StatisticMetaData
from homeassistant.components.recorder.statistics import async_import_statistics
from homeassistant.config_entries import ConfigEntry
Expand All @@ -12,14 +21,6 @@

from .config_flow import create_account_from_config
from .const import WATER_METER_NAME
from .eow import (
Account,
Client,
EyeOnWaterAPIError,
EyeOnWaterAuthError,
EyeOnWaterResponseIsEmpty,
Meter,
)

_LOGGER = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 7d44b74

Please sign in to comment.