home-assistant-HomeWhiz / home-assistant-HomeWhiz

Home Assistant custom component for devices that can connect to HomeWhiz mobile app (Beko, Grundig, Arcelik)
MIT License
82 stars 22 forks source link

DefaultValueNotFound error when trying to setup Arçelik Gurme Tea Machine #173

Closed cemkeylan closed 1 month ago

cemkeylan commented 6 months ago

Hello, I am having issues trying to setup my tea machine, this is the error that I am seeing on the logs. I know the tea machine isn't officially supported, but I saw another issue regarding Arçelik Gurme so I decided to post about it. The model of the tea machine is CM9058B, and I can provide any more info that might be necessary.

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 17:10:52 (1 occurrences)
Last logged: 17:10:52

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 72, in from_dict
    value = get_default_value_for_field(field, field_type)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/dataclasses.py", line 21, in get_default_value_for_field
    raise DefaultValueNotFoundError()
dacite.dataclasses.DefaultValueNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/homewhiz/config_flow.py", line 129, in async_step_bluetooth_connect
    contents = await fetch_appliance_contents(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/homewhiz/api.py", line 282, in fetch_appliance_contents
    config=from_dict(ApplianceConfiguration, config), localization=localization
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 64, in from_dict
    value = _build_value(type_=field_type, data=field_data, config=config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 95, in _build_value
    data = _build_value_for_union(union=type_, data=data, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 113, in _build_value_for_union
    return _build_value(type_=types[0], data=data, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 99, in _build_value
    data = from_dict(data_class=type_, data=data, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dacite/core.py", line 76, in from_dict
    raise MissingValueError(field.name)
dacite.exceptions.MissingValueError: missing value for field "teaRecipeInformation.recipeFormatVersion"
sarpdoruk commented 3 months ago
  1. SSH into the server/machine/docker container wherever you're running HA.
  2. cd into /YOUR_CONFIG_PATH/custom_components/homewhiz.
  3. Open appliance_config.py file with an editor such as vi.
  4. Change this line to recipeFormatVersion: str | None so that it doesn't throw an error.
  5. Remove the __pycache__ folder.
  6. Restart home assistant.

You should now be able to add your device via Cloud. Rest is on you.

TechHummel commented 3 months ago

Thanks for that fix! Is everything else working fine? I opened a pull request with your change and will merge once you confirm. Thanks ☺️

sarpdoruk commented 3 months ago

Thanks for that fix! Is everything else working fine? I opened a pull request with your change and will merge once you confirm. Thanks 😄

This little fix only allows us to setup the appliance. I think there's more to take care of before we can say it works. Regardless, this PR is still an improvement and perhaps a determined dev can make it work.

cemkeylan commented 3 months ago

Exactly, the setup works now, but all of the presented entities are unavailable