mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Add Abode camera on and off support (#35164)
* Add Abode camera controls * Add tests for camera turn on and off service * Bump abodepy version * Bump abodepy version and updates to reflect changes * Update manifest
This commit is contained in:
parent
093bd863ba
commit
36cb818cd0
@ -261,6 +261,7 @@ def setup_abode_events(hass):
|
|||||||
TIMELINE.AUTOMATION_GROUP,
|
TIMELINE.AUTOMATION_GROUP,
|
||||||
TIMELINE.DISARM_GROUP,
|
TIMELINE.DISARM_GROUP,
|
||||||
TIMELINE.ARM_GROUP,
|
TIMELINE.ARM_GROUP,
|
||||||
|
TIMELINE.ARM_FAULT_GROUP,
|
||||||
TIMELINE.TEST_GROUP,
|
TIMELINE.TEST_GROUP,
|
||||||
TIMELINE.CAPTURE_GROUP,
|
TIMELINE.CAPTURE_GROUP,
|
||||||
TIMELINE.DEVICE_GROUP,
|
TIMELINE.DEVICE_GROUP,
|
||||||
|
@ -82,8 +82,21 @@ class AbodeCamera(AbodeDevice, Camera):
|
|||||||
|
|
||||||
return None
|
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):
|
def _capture_callback(self, capture):
|
||||||
"""Update the image with the device then refresh device."""
|
"""Update the image with the device then refresh device."""
|
||||||
self._device.update_image_location(capture)
|
self._device.update_image_location(capture)
|
||||||
self.get_image()
|
self.get_image()
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self):
|
||||||
|
"""Return true if on."""
|
||||||
|
return self._device.is_on
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Abode",
|
"name": "Abode",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/abode",
|
"documentation": "https://www.home-assistant.io/integrations/abode",
|
||||||
"requirements": ["abodepy==0.19.0"],
|
"requirements": ["abodepy==1.1.0"],
|
||||||
"codeowners": ["@shred86"],
|
"codeowners": ["@shred86"],
|
||||||
"homekit": {
|
"homekit": {
|
||||||
"models": ["Abode", "Iota"]
|
"models": ["Abode", "Iota"]
|
||||||
|
@ -100,7 +100,7 @@ WazeRouteCalculator==0.12
|
|||||||
YesssSMS==0.4.1
|
YesssSMS==0.4.1
|
||||||
|
|
||||||
# homeassistant.components.abode
|
# homeassistant.components.abode
|
||||||
abodepy==0.19.0
|
abodepy==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.accuweather
|
# homeassistant.components.accuweather
|
||||||
accuweather==0.0.9
|
accuweather==0.0.9
|
||||||
|
@ -43,7 +43,7 @@ WSDiscovery==2.0.0
|
|||||||
YesssSMS==0.4.1
|
YesssSMS==0.4.1
|
||||||
|
|
||||||
# homeassistant.components.abode
|
# homeassistant.components.abode
|
||||||
abodepy==0.19.0
|
abodepy==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.accuweather
|
# homeassistant.components.accuweather
|
||||||
accuweather==0.0.9
|
accuweather==0.0.9
|
||||||
|
@ -38,3 +38,33 @@ async def test_capture_image(hass):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
mock_capture.assert_called_once()
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user