Skip to content

Commit

Permalink
Merge pull request #1 from nonsleepr/params
Browse files Browse the repository at this point in the history
Enable/disable motion detection
  • Loading branch information
nonsleepr authored Dec 10, 2019
2 parents 74c1bad + e414631 commit 0a05dd7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion custom_components/eufy_security/camera.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Define support for Eufy Security cameras/doorbells."""
import asyncio
import logging
from enum import Enum

from eufy_security.errors import EufySecurityError
from haffmpeg.camera import CameraMjpeg
Expand Down Expand Up @@ -56,12 +57,18 @@ def brand(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
return {
attributes = {
ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,
ATTR_HARDWARE_VERSION: self._camera.hardware_version,
ATTR_SERIAL: self._camera.serial,
ATTR_SOFTWARE_VERSION: self._camera.software_version,
}
for k, v in self._camera.params.items():
if isinstance(k, Enum):
attributes[k.name.lower()] = v
else:
attributes[str(k)] = v
return attributes

@property
def model(self):
Expand Down Expand Up @@ -102,6 +109,14 @@ async def async_camera_image(self):

return self._last_image

async def async_disable_motion_detection(self):
"""Disable doorbell's motion detection"""
await self._camera.async_stop_detection()

async def async_enable_motion_detection(self):
"""Enable doorbell's motion detection"""
await self._camera.async_start_detection()

async def async_turn_off(self):
"""Turn off the RTSP stream."""
try:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/eufy_security/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/eufy_security",
"requirements": [
"python-eufy-security==0.1.1"
"python-eufy-security==0.2.0"
],
"dependencies": [
"ffmpeg"
],
"codeowners": [
"@bachya"
"@nonsleepr"
]
}

0 comments on commit 0a05dd7

Please sign in to comment.