home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.1k stars 29.76k forks source link

Can't complete todo item with due date #122346

Open stormbyte opened 1 month ago

stormbyte commented 1 month ago

The problem

When home assistant creates a todo item with a due date, it can no longer complete the todo item. error:

Failed to call service todo/update_item. 'CalendarObjectResource' object has no attribute 'set_due'

Without a due date it works fine.

What version of Home Assistant Core has the issue?

core-2024.7.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

caldav

Link to integration documentation on our website

https://www.home-assistant.io/integrations/caldav/

Diagnostics information

No response

Example YAML snippet

service: todo.add_item
metadata: {}
data:
  item: Container {{ states("sensor.afvalwijzer_day_after_tomorrow") }}
  due_datetime: "{{ (now() + timedelta(days=2)).strftime('%Y-%m-%d') }} 07:00:00"
target:
  entity_id: todo.inbox

Anything in the logs that might be useful for us?

2024-07-22 01:23:02.798 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140271695109792] 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 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/todo/__init__.py", line 501, in _async_update_todo_item
    await entity.async_update_todo_item(item=TodoItem(**updated_data))
  File "/usr/src/homeassistant/homeassistant/components/caldav/todo.py", line 162, in async_update_todo_item
    todo.set_due(due)  # type: ignore[attr-defined]
    ^^^^^^^^^^^^

Additional information

Without the due date set the function works. it's connected with vikunja. Complete the task is possible with the vikunja interface. The completed task is synced back to the caldav todo list.

home-assistant[bot] commented 1 month ago

caldav documentation caldav source