Add EntityFeature enum to Lock (#69118)
This commit is contained in:
parent
ea148a1b8e
commit
721db6d962
4 changed files with 18 additions and 9 deletions
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
import asyncio
|
||||
|
||||
from homeassistant.components.lock import SUPPORT_OPEN, LockEntity
|
||||
from homeassistant.components.lock import LockEntity, LockEntityFeature
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
STATE_JAMMED,
|
||||
|
@ -60,7 +60,7 @@ class DemoLock(LockEntity):
|
|||
"""Initialize the lock."""
|
||||
self._attr_name = name
|
||||
if openable:
|
||||
self._attr_supported_features = SUPPORT_OPEN
|
||||
self._attr_supported_features = LockEntityFeature.OPEN
|
||||
self._state = state
|
||||
self._openable = openable
|
||||
self._jam_on_operation = jam_on_operation
|
||||
|
@ -113,5 +113,5 @@ class DemoLock(LockEntity):
|
|||
def supported_features(self):
|
||||
"""Flag supported features."""
|
||||
if self._openable:
|
||||
return SUPPORT_OPEN
|
||||
return LockEntityFeature.OPEN
|
||||
return 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue