Alexa motion sensor (#17798)
* Alexa: add motion sensors * Alexa: add motion sensor tests * Fix comparison and lint
This commit is contained in:
1 parent
8a4c78b69f
commit
6b7cbca04c
2 files changed
+64
No files matched your search
@@ -725,6 +725,37 @@ def test_contact_sensor(hass):
|
||||
'DETECTED')
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_motion_sensor(hass):
|
||||
"""Test motion sensor discovery."""
|
||||
device = (
|
||||
'binary_sensor.test_motion',
|
||||
'on',
|
||||
{
|
||||
'friendly_name': "Test Motion Sensor",
|
||||
'device_class': 'motion',
|
||||
}
|
||||
)
|
||||
appliance = yield from discovery_test(device, hass)
|
||||
|
||||
assert appliance['endpointId'] == 'binary_sensor#test_motion'
|
||||
assert appliance['displayCategories'][0] == 'MOTION_SENSOR'
|
||||
assert appliance['friendlyName'] == 'Test Motion Sensor'
|
||||
|
||||
(capability,) = assert_endpoint_capabilities(
|
||||
appliance,
|
||||
'Alexa.MotionSensor')
|
||||
assert capability['interface'] == 'Alexa.MotionSensor'
|
||||
properties = capability['properties']
|
||||
assert properties['retrievable'] is True
|
||||
assert {'name': 'detectionState'} in properties['supported']
|
||||
|
||||
properties = yield from reported_properties(hass,
|
||||
'binary_sensor#test_motion')
|
||||
properties.assert_equal('Alexa.MotionSensor', 'detectionState',
|
||||
'DETECTED')
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_unknown_sensor(hass):
|
||||
"""Test sensors of unknown quantities are not discovered."""
|
||||
|
||||
Reference in new issue
Block a user