basbruss / adaptive-cover

An Adaptive Cover component for HomeAsisstant to control covers based on the sun's position
MIT License
90 stars 11 forks source link

Resetting manual override results in exception #218

Closed cybe closed 3 months ago

cybe commented 3 months ago

What version of Adaptive Cover are you using?

1.3.1

What version of Home Assistant are you using?

2024.6.2

Checklist

Describe the issue

Pressing the "Reset Manual Override" button during an active manual override results in the following exception:

2024-06-16 09:01:05.906 DEBUG (MainThread) [custom_components.adaptive_cover.const] Resetting manual override for: cover.dummy_ost
2024-06-16 09:01:05.908 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281472354485008] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 134, in _async_press_action
    await self.async_press()
  File "/config/custom_components/adaptive_cover/button.py", line 85, in async_press
    await self.coordinator.async_set_position(entity)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AdaptiveDataUpdateCoordinator.async_set_position() missing 1 required positional argument: 'state'

I guess the position argument is missing here: https://github.com/basbruss/adaptive-cover/blob/4ee1838c301c54cdcb910be477766e10bc9f4840/custom_components/adaptive_cover/button.py#L85

Note that the automatic reset after the manual override duration still works.

Reproduction steps

  1. Create a vertical adaptive cover
  2. Manually setting the cover to 40%
  3. Press the button "Reset Manual Override"
  4. Exception occurs and is visible in the UI and log.

Diagnostics dump

config_entry-adaptive_cover-f36cf4d627b45764554350db69e3e3de.json