Update todo move item API to reference previous uid (#1958)

* Update todo move item API

* Update docs/core/entity/todo.md

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Allen Porter 2023-10-30 23:24:42 -07:00 committed by GitHub
parent 5412821eb4
commit b615e0b645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ class MyTodoListEntity(TodoListEntity):
A To-do list entity may support re-ordering To-do items in the list by specifying
the `MOVE_TODO_ITEM` supported feature. The To-do item with the specified `uid`
should be moved to the position in the list specified by `pos` (`0` is the first
should be moved to the position in the list after the one specified by `previous_uid` (`None` means move to the first
position in the To-do list).
```python
@ -91,7 +91,11 @@ from homeassistant.components.todo import TodoListEntity
class MyTodoListEntity(TodoListEntity):
async def async_move_todo_item(self, uid: str, pos: int) -> None:
async def async_move_todo_item(
self,
uid: str,
previous_uid: str | None = None
) -> None:
"""Move an item in the To-do list."""
```