Clean up camera and demo camera (#34058)
* Clean up demo camera * Complete test_motion_detection * Clean up image reading * Clean up camera integration async methods * Fix and clean camera integration tests * Fix image processing patch
This commit is contained in:
1 parent
4f519a2fe1
commit
20aa089243
5 files changed
+63
-63
No files matched your search
@@ -373,7 +373,7 @@ class Camera(Entity):
|
||||
|
||||
async def async_camera_image(self):
|
||||
"""Return bytes of camera image."""
|
||||
return await self.hass.async_add_job(self.camera_image)
|
||||
return await self.hass.async_add_executor_job(self.camera_image)
|
||||
|
||||
async def handle_async_still_stream(self, request, interval):
|
||||
"""Generate an HTTP MJPEG stream from camera images."""
|
||||
@@ -409,7 +409,7 @@ class Camera(Entity):
|
||||
|
||||
async def async_turn_off(self):
|
||||
"""Turn off camera."""
|
||||
await self.hass.async_add_job(self.turn_off)
|
||||
await self.hass.async_add_executor_job(self.turn_off)
|
||||
|
||||
def turn_on(self):
|
||||
"""Turn off camera."""
|
||||
@@ -417,25 +417,23 @@ class Camera(Entity):
|
||||
|
||||
async def async_turn_on(self):
|
||||
"""Turn off camera."""
|
||||
await self.hass.async_add_job(self.turn_on)
|
||||
await self.hass.async_add_executor_job(self.turn_on)
|
||||
|
||||
def enable_motion_detection(self):
|
||||
"""Enable motion detection in the camera."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@callback
|
||||
def async_enable_motion_detection(self):
|
||||
async def async_enable_motion_detection(self):
|
||||
"""Call the job and enable motion detection."""
|
||||
return self.hass.async_add_job(self.enable_motion_detection)
|
||||
await self.hass.async_add_executor_job(self.enable_motion_detection)
|
||||
|
||||
def disable_motion_detection(self):
|
||||
"""Disable motion detection in camera."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@callback
|
||||
def async_disable_motion_detection(self):
|
||||
async def async_disable_motion_detection(self):
|
||||
"""Call the job and disable motion detection."""
|
||||
return self.hass.async_add_job(self.disable_motion_detection)
|
||||
await self.hass.async_add_executor_job(self.disable_motion_detection)
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
|
||||
Reference in new issue
Block a user