Skip to content

Commit 7bb4809

Browse files
authored
Merge pull request #140 from TheZoker/fix-deprecation
Fix `SUPPORT_ON_OFF` and `SUPPORT_STREAM` depreciation
2 parents 7e41bf8 + bac2990 commit 7bb4809

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

custom_components/yi_hack/camera.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from haffmpeg.camera import CameraMjpeg
1111
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
1212
from homeassistant.components import mqtt
13-
from homeassistant.components.camera import (SUPPORT_ON_OFF, SUPPORT_STREAM,
14-
Camera)
13+
from homeassistant.components.camera import (Camera, CameraEntityFeature)
1514
from homeassistant.components.ffmpeg import CONF_EXTRA_ARGUMENTS, DATA_FFMPEG
1615
from homeassistant.config_entries import ConfigEntry
1716
from homeassistant.const import (CONF_HOST, CONF_MAC, CONF_NAME, CONF_PASSWORD,
@@ -176,9 +175,9 @@ async def async_will_remove_from_hass(self):
176175
self._mqtt_subscription()
177176

178177
@property
179-
def supported_features(self) -> int:
178+
def supported_features(self) -> CameraEntityFeature:
180179
"""Return supported features."""
181-
return SUPPORT_STREAM | SUPPORT_ON_OFF
180+
return CameraEntityFeature.STREAM | CameraEntityFeature.ON_OFF
182181

183182
def turn_off(self):
184183
"""Turn off camera"""
@@ -500,9 +499,9 @@ async def async_will_remove_from_hass(self):
500499
self._mqtt_image_subscription()
501500

502501
@property
503-
def supported_features(self) -> int:
502+
def supported_features(self) -> CameraEntityFeature:
504503
"""Return supported features."""
505-
return SUPPORT_STREAM | SUPPORT_ON_OFF
504+
return CameraEntityFeature.STREAM | CameraEntityFeature.ON_OFF
506505

507506
def turn_off(self):
508507
"""Turn off camera"""

0 commit comments

Comments
 (0)