Skip to content

Commit

Permalink
Add: turn_on and turn_off services
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajNyiri committed Oct 8, 2020
1 parent ab52fda commit 19dd52a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions custom_components/tapo_control/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pytapo import Tapo
from homeassistant.util import slugify
from homeassistant.helpers import entity_platform
from homeassistant.components.camera import SUPPORT_STREAM, Camera
from homeassistant.components.camera import SUPPORT_STREAM, SUPPORT_ON_OFF, Camera
from homeassistant.components.ffmpeg import DATA_FFMPEG
from homeassistant.helpers.aiohttp_client import (
async_aiohttp_proxy_stream
Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, hass: HomeAssistant, entry: dict, tapoData: Tapo, HDStream: b

@property
def supported_features(self):
return SUPPORT_STREAM
return SUPPORT_STREAM | SUPPORT_ON_OFF

@property
def icon(self) -> str:
Expand Down Expand Up @@ -277,6 +277,12 @@ async def async_enable_motion_detection(self):
async def async_disable_motion_detection(self):
await self.hass.async_add_executor_job(self._controller.setMotionDetection, True)
await self._coordinator.async_request_refresh()

async def async_turn_on(self):
await self.set_privacy_mode("off")

async def async_turn_off(self):
await self.set_privacy_mode("on")

async def set_auto_track_mode(self, auto_track_mode: str):
if(auto_track_mode == "on"):
Expand Down

0 comments on commit 19dd52a

Please sign in to comment.