Skip to content

Commit

Permalink
fix: Disable update features when enable_update is false
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Oct 31, 2023
1 parent 1413e72 commit 782b75d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/o365/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ async def _async_setup_task_services(hass, config, perms):
class O365TodoList(O365Entity, TodoListEntity):
"""O365 Tasks sensor processing."""

_attr_supported_features = (
TodoListEntityFeature.CREATE_TODO_ITEM
| TodoListEntityFeature.UPDATE_TODO_ITEM
| TodoListEntityFeature.DELETE_TODO_ITEM
)

def __init__(
self, hass, coordinator, todolist, name, task, config, entity_id, unique_id
):
Expand All @@ -163,6 +157,12 @@ def __init__(
self._todo_items = None
self._extra_attributes = None
self._update_status(hass)
if config.get(CONF_TODO_SENSORS).get(CONF_ENABLE_UPDATE):
self._attr_supported_features = (
TodoListEntityFeature.CREATE_TODO_ITEM
| TodoListEntityFeature.UPDATE_TODO_ITEM
| TodoListEntityFeature.DELETE_TODO_ITEM
)

@property
def icon(self):
Expand Down

0 comments on commit 782b75d

Please sign in to comment.