From 1cd1facbd045b1c672ebd47a93221ce90b473a7f Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 23 Feb 2017 17:33:54 +0100 Subject: [PATCH] Add device_class to image_processing (#6186) * Add image_processing device_class * Fix comments * address comments --- homeassistant/components/image_processing/__init__.py | 5 +++++ .../components/image_processing/microsoft_face_identify.py | 5 +++++ homeassistant/components/image_processing/openalpr_local.py | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/homeassistant/components/image_processing/__init__.py b/homeassistant/components/image_processing/__init__.py index 8e59ba53958..c63d3d01ce9 100644 --- a/homeassistant/components/image_processing/__init__.py +++ b/homeassistant/components/image_processing/__init__.py @@ -28,6 +28,11 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=10) +DEVICE_CLASSES = [ + 'alpr', # automatic license plate recognition + 'face', # face +] + SERVICE_SCAN = 'scan' ATTR_CONFIDENCE = 'confidence' diff --git a/homeassistant/components/image_processing/microsoft_face_identify.py b/homeassistant/components/image_processing/microsoft_face_identify.py index 1cc17f1443b..8d716bea0d5 100644 --- a/homeassistant/components/image_processing/microsoft_face_identify.py +++ b/homeassistant/components/image_processing/microsoft_face_identify.py @@ -90,6 +90,11 @@ class ImageProcessingFaceEntity(ImageProcessingEntity): return state + @property + def device_class(self): + """Return the class of this device, from component DEVICE_CLASSES.""" + return 'face' + @property def state_attributes(self): """Return device specific state attributes.""" diff --git a/homeassistant/components/image_processing/openalpr_local.py b/homeassistant/components/image_processing/openalpr_local.py index dbd404dd04c..a9378dd653d 100644 --- a/homeassistant/components/image_processing/openalpr_local.py +++ b/homeassistant/components/image_processing/openalpr_local.py @@ -94,6 +94,11 @@ class ImageProcessingAlprEntity(ImageProcessingEntity): plate = i_pl return plate + @property + def device_class(self): + """Return the class of this device, from component DEVICE_CLASSES.""" + return 'alpr' + @property def state_attributes(self): """Return device specific state attributes."""