Move part of image_processing tests (#5634)
* Move part of image_processing tests * fix lint
This commit is contained in:
1 parent
24f828d7eb
commit
261ffbbfea
3 files changed
+62
-48
No files matched your search
@@ -5,7 +5,6 @@ For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/demo/
|
||||
"""
|
||||
|
||||
from homeassistant.components.image_processing import ImageProcessingEntity
|
||||
from homeassistant.components.image_processing.openalpr_local import (
|
||||
ImageProcessingAlprEntity)
|
||||
from homeassistant.components.image_processing.microsoft_face_identify import (
|
||||
@@ -15,42 +14,12 @@ from homeassistant.components.image_processing.microsoft_face_identify import (
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the demo image_processing platform."""
|
||||
add_devices([
|
||||
DemoImageProcessing('camera.demo_camera', "Demo"),
|
||||
DemoImageProcessingAlpr('camera.demo_camera', "Demo Alpr"),
|
||||
DemoImageProcessingFaceIdentify(
|
||||
'camera.demo_camera', "Demo Face Identify")
|
||||
])
|
||||
|
||||
|
||||
class DemoImageProcessing(ImageProcessingEntity):
|
||||
"""Demo alpr image processing entity."""
|
||||
|
||||
def __init__(self, camera_entity, name):
|
||||
"""Initialize demo alpr."""
|
||||
self._name = name
|
||||
self._camera = camera_entity
|
||||
self._count = 0
|
||||
|
||||
@property
|
||||
def camera_entity(self):
|
||||
"""Return camera entity id from process pictures."""
|
||||
return self._camera
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the entity."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the entity."""
|
||||
return self._count
|
||||
|
||||
def process_image(self, image):
|
||||
"""Process image."""
|
||||
self._count += 1
|
||||
|
||||
|
||||
class DemoImageProcessingAlpr(ImageProcessingAlprEntity):
|
||||
"""Demo alpr image processing entity."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user