From 636e7aa31e645a07aa64572dd9443c3e2e869466 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 26 Jan 2017 23:18:15 +0100 Subject: [PATCH] [microsoft_face] Small error fixes (#5577) * [microsoft_face] Small error fixes * add array to exclusion --- .../components/image_processing/microsoft_face_identify.py | 4 +++- homeassistant/components/microsoft_face.py | 2 +- homeassistant/components/services.yaml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/image_processing/microsoft_face_identify.py b/homeassistant/components/image_processing/microsoft_face_identify.py index c8cb6fc4080..0402f272eeb 100644 --- a/homeassistant/components/image_processing/microsoft_face_identify.py +++ b/homeassistant/components/image_processing/microsoft_face_identify.py @@ -160,8 +160,10 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceIdentifyEntity): face_data = yield from self._api.call_api( 'post', 'detect', image, binary=True) - face_ids = [data['faceId'] for data in face_data] + if face_data is None or len(face_data) < 1: + return + face_ids = [data['faceId'] for data in face_data] detect = yield from self._api.call_api( 'post', 'identify', {'faceIds': face_ids, 'personGroupId': self._face_group}) diff --git a/homeassistant/components/microsoft_face.py b/homeassistant/components/microsoft_face.py index 3f4483e83c3..dc0e9001b24 100644 --- a/homeassistant/components/microsoft_face.py +++ b/homeassistant/components/microsoft_face.py @@ -367,7 +367,7 @@ class MicrosoftFace(object): answer = yield from response.json() _LOGGER.debug("Read from microsoft face api: %s", answer) - if response.status == 200: + if response.status == 200 or response.status == 202: return answer _LOGGER.warning("Error %d microsoft face api %s", diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml index dea38cb77f8..c390f65f5a0 100644 --- a/homeassistant/components/services.yaml +++ b/homeassistant/components/services.yaml @@ -154,7 +154,7 @@ microsoft_face: description: Train a person group. fields: - name: + group: description: Name of the group example: 'family' @@ -186,7 +186,7 @@ microsoft_face: description: Add a new picture to a person. fields: - name: + person: description: Name of the person example: 'Hans'