Add contact sensors to alexa smart home (#17704)
* add contact sensors to alexa smart home * door sensors are binary_sensors * fix tests; cleanup * lint * fix state * Add missing doc string
This commit is contained in:
1 parent
312d49caec
commit
9c7d3c2a63
2 files changed
+88
-4
No files matched your search
@@ -694,6 +694,37 @@ def test_temp_sensor(hass):
|
||||
{'value': 42.0, 'scale': 'FAHRENHEIT'})
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_contact_sensor(hass):
|
||||
"""Test contact sensor discovery."""
|
||||
device = (
|
||||
'binary_sensor.test_contact',
|
||||
'on',
|
||||
{
|
||||
'friendly_name': "Test Contact Sensor",
|
||||
'device_class': 'door',
|
||||
}
|
||||
)
|
||||
appliance = yield from discovery_test(device, hass)
|
||||
|
||||
assert appliance['endpointId'] == 'binary_sensor#test_contact'
|
||||
assert appliance['displayCategories'][0] == 'CONTACT_SENSOR'
|
||||
assert appliance['friendlyName'] == 'Test Contact Sensor'
|
||||
|
||||
(capability,) = assert_endpoint_capabilities(
|
||||
appliance,
|
||||
'Alexa.ContactSensor')
|
||||
assert capability['interface'] == 'Alexa.ContactSensor'
|
||||
properties = capability['properties']
|
||||
assert properties['retrievable'] is True
|
||||
assert {'name': 'detectionState'} in properties['supported']
|
||||
|
||||
properties = yield from reported_properties(hass,
|
||||
'binary_sensor#test_contact')
|
||||
properties.assert_equal('Alexa.ContactSensor', 'detectionState',
|
||||
'DETECTED')
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_unknown_sensor(hass):
|
||||
"""Test sensors of unknown quantities are not discovered."""
|
||||
|
||||
Reference in new issue
Block a user