Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions homeassistant/components/abode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def event_callback(event, event_json):
TIMELINE.AUTOMATION_GROUP,
TIMELINE.DISARM_GROUP,
TIMELINE.ARM_GROUP,
TIMELINE.ARM_FAULT_GROUP,
TIMELINE.TEST_GROUP,
TIMELINE.CAPTURE_GROUP,
TIMELINE.DEVICE_GROUP,
Expand Down
13 changes: 13 additions & 0 deletions homeassistant/components/abode/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,21 @@ def camera_image(self):

return None

def turn_on(self):
"""Turn on camera."""
self._device.privacy_mode(False)

def turn_off(self):
"""Turn off camera."""
self._device.privacy_mode(True)

def _capture_callback(self, capture):
"""Update the image with the device then refresh device."""
self._device.update_image_location(capture)
self.get_image()
self.schedule_update_ha_state()

@property
def is_on(self):
"""Return true if on."""
return self._device.is_on
2 changes: 1 addition & 1 deletion homeassistant/components/abode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Abode",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/abode",
"requirements": ["abodepy==0.19.0"],
"requirements": ["abodepy==1.1.0"],
"codeowners": ["@shred86"],
"homekit": {
"models": ["Abode", "Iota"]
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ WazeRouteCalculator==0.12
YesssSMS==0.4.1

# homeassistant.components.abode
abodepy==0.19.0
abodepy==1.1.0

# homeassistant.components.accuweather
accuweather==0.0.9
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ WSDiscovery==2.0.0
YesssSMS==0.4.1

# homeassistant.components.abode
abodepy==0.19.0
abodepy==1.1.0

# homeassistant.components.accuweather
accuweather==0.0.9
Expand Down
30 changes: 30 additions & 0 deletions tests/components/abode/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,33 @@ async def test_capture_image(hass):
)
await hass.async_block_till_done()
mock_capture.assert_called_once()


async def test_camera_on(hass):
"""Test the camera turn on service."""
await setup_platform(hass, CAMERA_DOMAIN)

with patch("abodepy.AbodeCamera.privacy_mode") as mock_capture:
await hass.services.async_call(
CAMERA_DOMAIN,
"turn_on",
{ATTR_ENTITY_ID: "camera.test_cam"},
blocking=True,
)
await hass.async_block_till_done()
mock_capture.assert_called_once_with(False)


async def test_camera_off(hass):
"""Test the camera turn off service."""
await setup_platform(hass, CAMERA_DOMAIN)

with patch("abodepy.AbodeCamera.privacy_mode") as mock_capture:
await hass.services.async_call(
CAMERA_DOMAIN,
"turn_off",
{ATTR_ENTITY_ID: "camera.test_cam"},
blocking=True,
)
await hass.async_block_till_done()
mock_capture.assert_called_once_with(True)