DEVELOPMENT ENVIRONMENT

~liljamo/ha-ouman-eh800

f5cc7fbb8f28accde5d888af0ccf2b0840762454 — Jonni Liljamo 4 days ago acecc4e
feat: use hass helper to create httpx.AsyncClient
2 files changed, 7 insertions(+), 2 deletions(-)

M custom_components/ouman_eh800/__init__.py
M custom_components/ouman_eh800/eh800.py
M custom_components/ouman_eh800/__init__.py => custom_components/ouman_eh800/__init__.py +1 -0
@@ 29,6 29,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

    config = dict(entry.data)
    eh800 = EH800(
        hass,
        config[CONF_HOST],
        config[CONF_PORT],
        config[CONF_USERNAME],

M custom_components/ouman_eh800/eh800.py => custom_components/ouman_eh800/eh800.py +6 -2
@@ 2,6 2,8 @@ import dataclasses
import logging

from httpx import AsyncClient
from homeassistant.core import HomeAssistant
from homeassistant.helpers.httpx_client import get_async_client

_LOGGER = logging.getLogger(__name__)



@@ 80,11 82,13 @@ OPERATION_MODES: tuple[OperationMode, ...] = (


class EH800:
    def __init__(self, host: str, port: int, username: str, password: str) -> None:
    def __init__(
        self, hass: HomeAssistant, host: str, port: int, username: str, password: str
    ) -> None:
        self._uri = f"http://{host}:{port}"
        self._login = f"uid={username};pwd={password};"

        self._client = AsyncClient()
        self._client: AsyncClient = get_async_client(hass)

        self._request_query = "request?"
        for value in VALUES: