Implement Alexa.EventDetectionSensor for Alexa (#28276)

* Implement Alexa.EventDetectionSensor Interface

* Removed references to PR #28218 not yet merged into dev.

* Update tests to include Alexa Interface

* Guard for `unknown` and `unavailible` states.

* Fixed Unnecessary "elif" after "return"
This commit is contained in:
ochlocracy authored and Paulus Schoutsen committed 2019-12-14 08:47:45 +01:00
1 parent 3c86825e25
commit 3db7e8f5e9
5 files changed
+217 -3

No files matched your search

@@ -667,3 +667,45 @@ async def test_report_playback_state(hass):
properties.assert_equal(
"Alexa.PlaybackStateReporter", "playbackState", {"state": "STOPPED"}
)
async def test_report_image_processing(hass):
"""Test EventDetectionSensor implements humanPresenceDetectionState property."""
hass.states.async_set(
"image_processing.test_face",
0,
{
"friendly_name": "Test face",
"device_class": "face",
"faces": [],
"total_faces": 0,
},
)
properties = await reported_properties(hass, "image_processing#test_face")
properties.assert_equal(
"Alexa.EventDetectionSensor",
"humanPresenceDetectionState",
{"value": "NOT_DETECTED"},
)
hass.states.async_set(
"image_processing.test_classifier",
3,
{
"friendly_name": "Test classifier",
"device_class": "face",
"faces": [
{"confidence": 98.34, "name": "Hans", "age": 16.0, "gender": "male"},
{"name": "Helena", "age": 28.0, "gender": "female"},
{"confidence": 62.53, "name": "Luna"},
],
"total_faces": 3,
},
)
properties = await reported_properties(hass, "image_processing#test_classifier")
properties.assert_equal(
"Alexa.EventDetectionSensor",
"humanPresenceDetectionState",
{"value": "DETECTED"},
)