hon icon indicating copy to clipboard operation
hon copied to clipboard

Hon

Open mellorarma opened this issue 6 months ago • 17 comments

Hi! First, thank you for maintaining this integration — it's working well overall.

After updating to Home Assistant Core 2025.6, I've started seeing several compatibility warnings and one previously breaking issue that I’ve patched manually:

Previously breaking (now patched manually):

  • async_forward_entry_setup was removed in HA 2025.6 — had to replace with async_forward_entry_setups

Current warnings in logs:

  • HomeAssistantType is deprecated and should be replaced with HomeAssistant from homeassistant.core
  • Light entity (e.g. light.dishwasher_light) does not define supported_color_modes, which will break in a future HA version
  • Sensor entity (e.g. sensor.washing_machine_energy_consumption_current) is missing native_unit_of_measurement
  • Detected blocking import: import_module("python.appliances.wm") inside the event loop (non-breaking but suboptimal)

The integration is still functioning, but just flagging these for future compatibility. I’d be happy to help test any updates if needed. Thanks again!

mellorarma avatar Jun 12 '25 15:06 mellorarma

Hello,

In: \custom_components\hon_inti_.py line 58:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setup(entry, platform)**
    )
return True

replace hass.config_entries.async_forward_entry_setup(entry, platform) to hass.config_entries.async_forward_entry_setups(entry, platform)

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, platform)**
    )
return True

Now the device get connected:

Image

Now I will try to fix the problem with the sensors

Image

QuaKim avatar Jun 12 '25 17:06 QuaKim

this fixed it but now it doesnt detects my appliances

nobrega8 avatar Jun 12 '25 18:06 nobrega8

In log

Detected blocking call to import_module with args ('pyhon.appliances.td',) inside the event loop by custom integration 'hon' at custom_components/hon/init.py, line 34: hon = await Hon( (offender: /usr/local/lib/python3.13/site-packages/pyhon/appliance.py, line 52: self._extra: Optional[ApplianceBase] = importlib.import_module(), please create a bug report at https://github.com/Andre0512/hon/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 227, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 213, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.13/asyncio/base_events.py", line 706, in run_until_complete self.run_forever() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 677, in run_forever self._run_once() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2034, in _run_once handle._run() File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 894, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 660, in async_setup await self.__async_setup_with_context(hass, integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 749, in __async_setup_with_context result = await component.async_setup_entry(hass, self) File "/config/custom_components/hon/init.py", line 34, in async_setup_entry hon = await Hon(

QuaKim avatar Jun 12 '25 19:06 QuaKim

Will an update to download be available?

On 12 Jun 2025, at 20:11, QuaKim @.***> wrote:

 [https://avatars.githubusercontent.com/u/121525213?s=20&v=4]QuaKim left a comment (Andre0512/hon#303)https://github.com/Andre0512/hon/issues/303#issuecomment-2967883804

In log

Detected blocking call to import_module with args ('pyhon.appliances.td',) inside the event loop by custom integration 'hon' at custom_components/hon/init.py, line 34: hon = await Hon( (offender: /usr/local/lib/python3.13/site-packages/pyhon/appliance.py, line 52: self._extra: Optional[ApplianceBase] = importlib.import_module(), please create a bug report at https://github.com/Andre0512/hon/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 227, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 213, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.13/asyncio/base_events.py", line 706, in run_until_complete self.run_forever() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 677, in run_forever self._run_once() File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2034, in _run_once handle._run() File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 894, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 660, in async_setup await self.__async_setup_with_context(hass, integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 749, in __async_setup_with_context result = await component.async_setup_entry(hass, self) File "/config/custom_components/hon/init.py", line 34, in async_setup_entry hon = await Hon(

— Reply to this email directly, view it on GitHubhttps://github.com/Andre0512/hon/issues/303#issuecomment-2967883804, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BTA3E3GBIVWC6YOYT76R5HD3DHGEDAVCNFSM6AAAAAB7FZPDCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNRXHA4DGOBQGQ. You are receiving this because you authored the thread.Message ID: @.***>

mellorarma avatar Jun 12 '25 19:06 mellorarma

https://github.com/Andre0512/hon/issues/302#issuecomment-2967995802

ugkhan21 avatar Jun 12 '25 19:06 ugkhan21

I'm confused :) what should I do to fix it?

mdolejsi1 avatar Jun 12 '25 20:06 mdolejsi1

Hello everyone. Sensors look like this now. How can I fix please?

1000107241.jpg

pavluz avatar Jun 12 '25 21:06 pavluz

Hello,

In: \custom_components\hon_inti_.py line 58:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setup(entry, platform)**
    )
return True

replace hass.config_entries.async_forward_entry_setup(entry, platform) to hass.config_entries.async_forward_entry_setups(entry, platform)

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, platform)**
    )
return True

Now the device get connected:

Image

Now I will try to fix the problem with the sensors

Image

Hello, have you figured out how to fix this please?

pavluz avatar Jun 12 '25 21:06 pavluz

Now it's working

Image

Previously, In: \custom_components\hon_inti_.py line 58, I had changed

**hass.config_entries.async_forward_entry_setup(entry, platform)**

to

**hass.config_entries.async_forward_entry_setups(entry, platform)**

If we look at another line of code that calls hass.config_entries, we can see that it uses (entry, PLATFORMS) and not (entry, platform).

Change:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, platform)**
    )
return True

to:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)**
    )
return True

And Works !

PD: But I still have the issue where the sensors don’t update unless I reload the integration.

QuaKim avatar Jun 12 '25 21:06 QuaKim

I'm trying to setup the hOn integration for the first time on my HA installation and after editing the same lines as you did (via the web File Editor) I'm getting a different error

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 749, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hon/__init__.py", line 34, in async_setup_entry
    hon = await Hon(
          ^^^^^^^^^^
    ...<6 lines>...
    ).create()
    ^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/hon.py", line 77, in create
    await self.setup()
  File "/usr/local/lib/python3.13/site-packages/pyhon/hon.py", line 104, in setup
    appliances = await self.api.load_appliances()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/api.py", line 86, in load_appliances
    async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp:
               ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/handler/base.py", line 64, in get
    async with self._intercept(*args, **kwargs) as response:
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/handler/hon.py", line 75, in _intercept
    kwargs["headers"] = await self._check_headers(kwargs.get("headers", {}))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/handler/hon.py", line 64, in _check_headers
    await self.auth.authenticate()
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/auth.py", line 261, in authenticate
    if not await self._load_login():
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/auth.py", line 105, in _load_login
    login_url = await self._handle_redirects(login_url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/auth.py", line 143, in _handle_redirects
    redirect1 = await self._manual_redirect(login_url)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/auth.py", line 136, in _manual_redirect
    async with self._request.get(url, allow_redirects=False) as response:
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/handler/base.py", line 64, in get
    async with self._intercept(*args, **kwargs) as response:
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyhon/connection/handler/auth.py", line 36, in _intercept
    async with method(url, *args, **kwargs) as response:
               ~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 1480, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 635, in _request
    raise err_exc_cls(url)
aiohttp.client_exceptions.InvalidUrlClientError: /_ui/system/security/ChangePassword?retURL=/_ui/identity/oauth/ui/AuthorizationPage?source%3D<RANDOM_CHARS>%26display%3Dtouch&setupid=ChangePassword

I even changed my password from the Android application since I setup the account some years ago and thought that the ChangePassword at the very end was to forcing a change being it too old, but I still get the same error

thePier avatar Jun 14 '25 16:06 thePier

hello,

for me ok, but after update file "inti.py line 58", device is empty.

c4coer avatar Jun 15 '25 07:06 c4coer

I also have the same "Configuration failed" problem. I tried to do the changes you suggested but nothing changes, the integration says "No device or entity". If anyone has succeeded please write how you did it.

spazioteo avatar Jun 17 '25 15:06 spazioteo

Now it's working

Image

Previously, In: \custom_components\hon_inti_.py line 58, I had changed

**hass.config_entries.async_forward_entry_setup(entry, platform)**

to

**hass.config_entries.async_forward_entry_setups(entry, platform)**

If we look at another line of code that calls hass.config_entries, we can see that it uses (entry, PLATFORMS) and not (entry, platform).

Change:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, platform)**
    )
return True

to:

for platform in PLATFORMS:
    hass.async_create_task(
        **hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)**
    )
return True

And Works !

PD: But I still have the issue where the sensors don’t update unless I reload the integration.

hey, any chance you can share your wholte init.py?

i am absolutely a noob in programming, and i cannot make it run.. I did all the changes you said directly in studio code server in homeassistant, but it wont load up...

frankthecrank avatar Jun 20 '25 11:06 frankthecrank

hey, any chance you can share your wholte init.py?

i am absolutely a noob in programming, and i cannot make it run.. I did all the changes you said directly in studio code server in homeassistant, but it wont load up...

here it is!

import logging
from pathlib import Path
from typing import Any

import voluptuous as vol  # type: ignore[import-untyped]
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.helpers import config_validation as cv, aiohttp_client
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from pyhon import Hon

from .const import DOMAIN, PLATFORMS, MOBILE_ID, CONF_REFRESH_TOKEN

_LOGGER = logging.getLogger(__name__)

HON_SCHEMA = vol.Schema(
    {
        vol.Required(CONF_EMAIL): cv.string,
        vol.Required(CONF_PASSWORD): cv.string,
    }
)

CONFIG_SCHEMA = vol.Schema(
    {DOMAIN: vol.Schema(vol.All(cv.ensure_list, [HON_SCHEMA]))},
    extra=vol.ALLOW_EXTRA,
)


async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
    session = aiohttp_client.async_get_clientsession(hass)
    if (config_dir := hass.config.config_dir) is None:
        raise ValueError("Missing Config Dir")
    hon = await Hon(
        email=entry.data[CONF_EMAIL],
        password=entry.data[CONF_PASSWORD],
        mobile_id=MOBILE_ID,
        session=session,
        test_data_path=Path(config_dir),
        refresh_token=entry.data.get(CONF_REFRESH_TOKEN, ""),
    ).create()

    # Save the new refresh token
    hass.config_entries.async_update_entry(
        entry, data={**entry.data, CONF_REFRESH_TOKEN: hon.api.auth.refresh_token}
    )

    coordinator: DataUpdateCoordinator[dict[str, Any]] = DataUpdateCoordinator(
        hass, _LOGGER, name=DOMAIN
    )
    hon.subscribe_updates(coordinator.async_set_updated_data)

    hass.data.setdefault(DOMAIN, {})
    hass.data[DOMAIN][entry.unique_id] = {"hon": hon, "coordinator": coordinator}

    for platform in PLATFORMS:
            hass.async_create_task(
                hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
            )
#    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
    return True


async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
    refresh_token = hass.data[DOMAIN][entry.unique_id]["hon"].api.auth.refresh_token

    hass.config_entries.async_update_entry(
        entry, data={**entry.data, CONF_REFRESH_TOKEN: refresh_token}
    )
    unload = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
    if unload:
        if not hass.data[DOMAIN]:
            hass.data.pop(DOMAIN, None)
    return unload

QuaKim avatar Jun 20 '25 11:06 QuaKim

Hi Guys,

Any update on this issue? With workaround integrations works but sensors don't update... The only way to update sensors is reloading integration. Create and automation to reload the integration ever minute don't seems to be a good choice

bduartept1 avatar Jun 20 '25 20:06 bduartept1

I too have this sensor issue. Only gets data when you reload. I’ve got an automation to tell me when the washer finishes. But because the sensors don’t update it doesn’t work

On 20 Jun 2025, at 21:08, bduartept1 @.***> wrote:

 [https://avatars.githubusercontent.com/u/198207602?s=20&v=4]bduartept1 left a comment (Andre0512/hon#303)https://github.com/Andre0512/hon/issues/303#issuecomment-2992672967

Hi Guys,

Any update on this issue? With workaround integrations works but sensors don't update... The only way to update sensors is reloading integration. Create and automation to reload the integration ever minute don't seems to be a good choice

— Reply to this email directly, view it on GitHubhttps://github.com/Andre0512/hon/issues/303#issuecomment-2992672967, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BTA3E3CVKE2SK5S6S5EUCO33ERS5JAVCNFSM6AAAAAB7FZPDCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJSGY3TEOJWG4. You are receiving this because you authored the thread.Message ID: @.***>

mellorarma avatar Jun 20 '25 20:06 mellorarma

Hi Guys,

Any update on this issue? With workaround integrations works but sensors don't update... The only way to update sensors is reloading integration. Create and automation to reload the integration ever minute don't seems to be a good choice

It wasn't updating the sensors for me before either — with the previous version of HA — I’m still updating them with a script

QuaKim avatar Jun 20 '25 21:06 QuaKim