Skip to content

Commit

Permalink
Merge pull request #140 from TheZoker/fix-deprecation
Browse files Browse the repository at this point in the history
Fix `SUPPORT_ON_OFF` and `SUPPORT_STREAM` depreciation
  • Loading branch information
roleoroleo authored Dec 28, 2023
2 parents 7e41bf8 + bac2990 commit 7bb4809
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions custom_components/yi_hack/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from haffmpeg.camera import CameraMjpeg
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
from homeassistant.components import mqtt
from homeassistant.components.camera import (SUPPORT_ON_OFF, SUPPORT_STREAM,
Camera)
from homeassistant.components.camera import (Camera, CameraEntityFeature)
from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS, DATA_FFMPEG
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (CONF_HOST, CONF_MAC, CONF_NAME, CONF_PASSWORD,
Expand Down Expand Up @@ -176,9 +175,9 @@ async def async_will_remove_from_hass(self):
self._mqtt_subscription()

@property
def supported_features(self) -> int:
def supported_features(self) -> CameraEntityFeature:
"""Return supported features."""
return SUPPORT_STREAM | SUPPORT_ON_OFF
return CameraEntityFeature.STREAM | CameraEntityFeature.ON_OFF

def turn_off(self):
"""Turn off camera"""
Expand Down Expand Up @@ -500,9 +499,9 @@ async def async_will_remove_from_hass(self):
self._mqtt_image_subscription()

@property
def supported_features(self) -> int:
def supported_features(self) -> CameraEntityFeature:
"""Return supported features."""
return SUPPORT_STREAM | SUPPORT_ON_OFF
return CameraEntityFeature.STREAM | CameraEntityFeature.ON_OFF

def turn_off(self):
"""Turn off camera"""
Expand Down

0 comments on commit 7bb4809

Please sign in to comment.