Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix await coroutine for numbers and selects #269

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

sti0
Copy link
Contributor

@sti0 sti0 commented Jun 28, 2024

During the development on #268 I ran into these errors:

2024-06-28 18:03:25.333 WARNING (MainThread) [py.warnings] /workspaces/stiebel_eltron_isg_component/custom_components/stiebel_eltron_isg/select.py:109: RuntimeWarning: coroutine 'StiebelEltronModbusLWZDataCoordinator.set_data' was never awaited
Coroutine created at (most recent call last)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2741, in async_call
    response_data = await coro
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 977, in entity_service_call
    single_response = await _handle_entity_call(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1041, in _handle_entity_call
    task = hass.async_run_hass_job(job)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 939, in async_run_hass_job
    return self._async_add_hass_job(hassjob, *args, background=background)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 748, in _async_add_hass_job
    task = create_eager_task(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/util/async_.py", line 37, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/select/__init__.py", line 191, in async_handle_select_option
    await self.async_select_option(option)
  File "/workspaces/stiebel_eltron_isg_component/custom_components/stiebel_eltron_isg/select.py", line 109, in async_select_option
    self.coordinator.set_data(self.entity_description.key, key)
  self.coordinator.set_data(self.entity_description.key, key)
  
  
2024-06-28 18:02:34.609 WARNING (MainThread) [py.warnings] /workspaces/stiebel_eltron_isg_component/custom_components/stiebel_eltron_isg/number.py:250: RuntimeWarning: coroutine 'StiebelEltronModbusLWZDataCoordinator.set_data' was never awaited
Coroutine created at (most recent call last)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2741, in async_call
    response_data = await coro
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 977, in entity_service_call
    single_response = await _handle_entity_call(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    task = hass.async_run_hass_job(func, entity, data)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 939, in async_run_hass_job
    return self._async_add_hass_job(hassjob, *args, background=background)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/core.py", line 748, in _async_add_hass_job
    task = create_eager_task(
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/util/async_.py", line 37, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/number/__init__.py", line 121, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/workspaces/stiebel_eltron_isg_component/custom_components/stiebel_eltron_isg/number.py", line 250, in async_set_native_value
    self.coordinator.set_data(self.entity_description.key, value)
  self.coordinator.set_data(self.entity_description.key, value)

I have no idea why this is working in my production enviornment. But it throws errors in devcontainer and even when I change the component with the changes of #268 in my production env. This PR fixes these errors.

@pail23 pail23 merged commit 7751e4d into pail23:main Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants