Use EntityFeature enum in components (a**) (#69333)

This commit is contained in:
epenet 2022-04-05 23:42:05 +02:00 committed by GitHub
parent 8b2948f030
commit 246f4e081a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 169 additions and 237 deletions

View file

@ -4,7 +4,7 @@ import logging
from agent import AgentError
from homeassistant.components.camera import SUPPORT_ON_OFF
from homeassistant.components.camera import CameraEntityFeature
from homeassistant.components.mjpeg import MjpegCamera, filter_urllib3_logging
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers import entity_platform
@ -63,6 +63,8 @@ async def async_setup_entry(
class AgentCamera(MjpegCamera):
"""Representation of an Agent Device Stream."""
_attr_supported_features = CameraEntityFeature.ON_OFF
def __init__(self, device):
"""Initialize as a subclass of MjpegCamera."""
self.device = device
@ -134,11 +136,6 @@ class AgentCamera(MjpegCamera):
"""Return True if entity is connected."""
return self.device.connected
@property
def supported_features(self) -> int:
"""Return supported features."""
return SUPPORT_ON_OFF
@property
def is_on(self) -> bool:
"""Return true if on."""