Add EntityFeature enum to Lock (#69118)

This commit is contained in:
Franck Nijhof 2022-04-03 05:57:32 +02:00 committed by GitHub
parent ea148a1b8e
commit 721db6d962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 9 deletions

View file

@ -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