2016-03-09 09:25:50 +00:00
|
|
|
"""The tests for the MQTT lock platform."""
|
2020-03-09 16:40:00 +00:00
|
|
|
from homeassistant.components import lock
|
2020-03-17 07:09:19 +00:00
|
|
|
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_LOCKED, STATE_UNLOCKED
|
2019-01-27 17:54:52 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
2018-09-26 16:02:05 +00:00
|
|
|
|
2020-03-09 16:40:00 +00:00
|
|
|
from .common import (
|
2020-03-17 07:09:19 +00:00
|
|
|
help_test_availability_without_topic,
|
|
|
|
help_test_custom_availability_payload,
|
|
|
|
help_test_default_availability_payload,
|
2020-03-09 16:40:00 +00:00
|
|
|
help_test_discovery_broken,
|
|
|
|
help_test_discovery_removal,
|
|
|
|
help_test_discovery_update,
|
|
|
|
help_test_discovery_update_attr,
|
2020-03-12 01:00:47 +00:00
|
|
|
help_test_entity_device_info_remove,
|
2020-03-09 16:40:00 +00:00
|
|
|
help_test_entity_device_info_update,
|
2020-03-17 07:09:19 +00:00
|
|
|
help_test_entity_device_info_with_connection,
|
2020-03-09 16:40:00 +00:00
|
|
|
help_test_entity_device_info_with_identifier,
|
|
|
|
help_test_entity_id_update,
|
|
|
|
help_test_setting_attribute_via_mqtt_json_message,
|
2020-03-17 07:09:19 +00:00
|
|
|
help_test_setting_attribute_with_template,
|
2020-03-09 16:40:00 +00:00
|
|
|
help_test_unique_id,
|
|
|
|
help_test_update_with_json_attrs_bad_JSON,
|
|
|
|
help_test_update_with_json_attrs_not_dict,
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-03-09 16:40:00 +00:00
|
|
|
|
|
|
|
from tests.common import async_fire_mqtt_message
|
2019-04-10 20:56:34 +00:00
|
|
|
from tests.components.lock import common
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2020-03-17 07:09:19 +00:00
|
|
|
DEFAULT_CONFIG = {
|
|
|
|
lock.DOMAIN: {"platform": "mqtt", "name": "test", "command_topic": "test-topic"}
|
2020-03-11 16:34:19 +00:00
|
|
|
}
|
|
|
|
|
2018-10-24 20:20:25 +00:00
|
|
|
|
|
|
|
async def test_controlling_state_via_topic(hass, mqtt_mock):
|
|
|
|
"""Test the controlling state via topic."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"state_topic": "state-topic",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
2019-12-31 14:24:09 +00:00
|
|
|
"state_locked": "LOCKED",
|
|
|
|
"state_unlocked": "UNLOCKED",
|
2019-07-31 19:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
2019-12-31 14:24:09 +00:00
|
|
|
async_fire_mqtt_message(hass, "state-topic", "LOCKED")
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
|
2019-12-31 14:24:09 +00:00
|
|
|
async_fire_mqtt_message(hass, "state-topic", "UNLOCKED")
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
|
|
|
|
|
|
|
async def test_controlling_non_default_state_via_topic(hass, mqtt_mock):
|
|
|
|
"""Test the controlling state via topic."""
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"state_topic": "state-topic",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
|
|
|
"state_locked": "closed",
|
|
|
|
"state_unlocked": "open",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
|
|
|
async_fire_mqtt_message(hass, "state-topic", "closed")
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
|
|
|
|
async_fire_mqtt_message(hass, "state-topic", "open")
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
|
|
|
|
|
|
|
async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock):
|
|
|
|
"""Test the controlling state via topic and JSON message."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"state_topic": "state-topic",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
2019-12-31 14:24:09 +00:00
|
|
|
"state_locked": "LOCKED",
|
|
|
|
"state_unlocked": "UNLOCKED",
|
|
|
|
"value_template": "{{ value_json.val }}",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
|
|
|
async_fire_mqtt_message(hass, "state-topic", '{"val":"LOCKED"}')
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
|
|
|
|
async_fire_mqtt_message(hass, "state-topic", '{"val":"UNLOCKED"}')
|
|
|
|
|
|
|
|
state = hass.states.get("lock.test")
|
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
|
|
|
|
|
|
|
async def test_controlling_non_default_state_via_topic_and_json_message(
|
|
|
|
hass, mqtt_mock
|
|
|
|
):
|
|
|
|
"""Test the controlling state via topic and JSON message."""
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"state_topic": "state-topic",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
|
|
|
"state_locked": "closed",
|
|
|
|
"state_unlocked": "open",
|
2019-07-31 19:25:30 +00:00
|
|
|
"value_template": "{{ value_json.val }}",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
2019-12-31 14:24:09 +00:00
|
|
|
async_fire_mqtt_message(hass, "state-topic", '{"val":"closed"}')
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
|
2019-12-31 14:24:09 +00:00
|
|
|
async_fire_mqtt_message(hass, "state-topic", '{"val":"open"}')
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2018-10-24 20:20:25 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
|
|
|
|
|
2019-04-10 20:56:34 +00:00
|
|
|
async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
|
|
|
"""Test optimistic mode without state topic."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
2019-12-31 14:24:09 +00:00
|
|
|
"state_locked": "LOCKED",
|
|
|
|
"state_unlocked": "UNLOCKED",
|
2019-07-31 19:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await common.async_lock(hass, "lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mqtt_mock.async_publish.assert_called_once_with("command-topic", "LOCK", 0, False)
|
2019-04-10 20:56:34 +00:00
|
|
|
mqtt_mock.async_publish.reset_mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await common.async_unlock(hass, "lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mqtt_mock.async_publish.assert_called_once_with("command-topic", "UNLOCK", 0, False)
|
2019-04-10 20:56:34 +00:00
|
|
|
mqtt_mock.async_publish.reset_mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
|
|
|
|
|
|
|
async def test_sending_mqtt_commands_and_explicit_optimistic(hass, mqtt_mock):
|
|
|
|
"""Test optimistic mode without state topic."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
lock.DOMAIN,
|
|
|
|
{
|
|
|
|
lock.DOMAIN: {
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "test",
|
|
|
|
"state_topic": "state-topic",
|
|
|
|
"command_topic": "command-topic",
|
|
|
|
"payload_lock": "LOCK",
|
|
|
|
"payload_unlock": "UNLOCK",
|
2019-12-31 14:24:09 +00:00
|
|
|
"state_locked": "LOCKED",
|
|
|
|
"state_unlocked": "UNLOCKED",
|
2019-07-31 19:25:30 +00:00
|
|
|
"optimistic": True,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await common.async_lock(hass, "lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mqtt_mock.async_publish.assert_called_once_with("command-topic", "LOCK", 0, False)
|
2019-04-10 20:56:34 +00:00
|
|
|
mqtt_mock.async_publish.reset_mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_LOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await common.async_unlock(hass, "lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mqtt_mock.async_publish.assert_called_once_with("command-topic", "UNLOCK", 0, False)
|
2019-04-10 20:56:34 +00:00
|
|
|
mqtt_mock.async_publish.reset_mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("lock.test")
|
2019-04-10 20:56:34 +00:00
|
|
|
assert state.state is STATE_UNLOCKED
|
|
|
|
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
|
|
|
|
|
|
|
|
2020-03-17 07:09:19 +00:00
|
|
|
async def test_availability_without_topic(hass, mqtt_mock):
|
|
|
|
"""Test availability without defined availability topic."""
|
|
|
|
await help_test_availability_without_topic(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-10-24 20:20:25 +00:00
|
|
|
|
|
|
|
|
2020-03-17 07:09:19 +00:00
|
|
|
async def test_default_availability_payload(hass, mqtt_mock):
|
|
|
|
"""Test availability by default payload with defined topic."""
|
|
|
|
await help_test_default_availability_payload(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
|
|
|
)
|
2018-10-24 20:20:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_custom_availability_payload(hass, mqtt_mock):
|
|
|
|
"""Test availability by custom payload with defined topic."""
|
2020-03-17 07:09:19 +00:00
|
|
|
await help_test_custom_availability_payload(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-10-24 20:20:25 +00:00
|
|
|
|
2018-09-25 17:32:25 +00:00
|
|
|
|
2019-01-21 00:41:50 +00:00
|
|
|
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
|
|
|
|
"""Test the setting of attribute via MQTT with JSON payload."""
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_setting_attribute_via_mqtt_json_message(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
async def test_setting_attribute_with_template(hass, mqtt_mock):
|
|
|
|
"""Test the setting of attribute via MQTT with JSON payload."""
|
|
|
|
await help_test_setting_attribute_with_template(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2019-01-21 00:41:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
|
|
|
|
"""Test attributes get extracted from a JSON result."""
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_update_with_json_attrs_not_dict(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, caplog, lock.DOMAIN, DEFAULT_CONFIG
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2019-01-21 00:41:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
|
|
|
|
"""Test attributes get extracted from a JSON result."""
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_update_with_json_attrs_bad_JSON(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, caplog, lock.DOMAIN, DEFAULT_CONFIG
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2019-01-21 00:41:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_discovery_update_attr(hass, mqtt_mock, caplog):
|
|
|
|
"""Test update of discovered MQTTAttributes."""
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_discovery_update_attr(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, caplog, lock.DOMAIN, DEFAULT_CONFIG
|
2020-03-09 16:40:00 +00:00
|
|
|
)
|
2019-01-21 00:41:50 +00:00
|
|
|
|
|
|
|
|
2018-12-19 18:26:07 +00:00
|
|
|
async def test_unique_id(hass):
|
2020-03-09 16:40:00 +00:00
|
|
|
"""Test unique id option only creates one lock per unique_id."""
|
|
|
|
config = {
|
|
|
|
lock.DOMAIN: [
|
|
|
|
{
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "Test 1",
|
|
|
|
"state_topic": "test-topic",
|
|
|
|
"command_topic": "test_topic",
|
|
|
|
"unique_id": "TOTALLY_UNIQUE",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"platform": "mqtt",
|
|
|
|
"name": "Test 2",
|
|
|
|
"state_topic": "test-topic",
|
|
|
|
"command_topic": "test_topic",
|
|
|
|
"unique_id": "TOTALLY_UNIQUE",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
await help_test_unique_id(hass, lock.DOMAIN, config)
|
2018-12-19 18:26:07 +00:00
|
|
|
|
|
|
|
|
2018-09-25 17:32:25 +00:00
|
|
|
async def test_discovery_removal_lock(hass, mqtt_mock, caplog):
|
|
|
|
"""Test removal of discovered lock."""
|
2020-03-11 16:34:19 +00:00
|
|
|
data = '{ "name": "test",' ' "command_topic": "test_topic" }'
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_discovery_removal(hass, mqtt_mock, caplog, lock.DOMAIN, data)
|
2019-01-08 15:45:38 +00:00
|
|
|
|
|
|
|
|
2019-01-14 20:01:42 +00:00
|
|
|
async def test_discovery_update_lock(hass, mqtt_mock, caplog):
|
|
|
|
"""Test update of discovered lock."""
|
|
|
|
data1 = (
|
|
|
|
'{ "name": "Beer",'
|
|
|
|
' "state_topic": "test_topic",'
|
|
|
|
' "command_topic": "command_topic",'
|
|
|
|
' "availability_topic": "availability_topic1" }'
|
|
|
|
)
|
|
|
|
data2 = (
|
|
|
|
'{ "name": "Milk",'
|
|
|
|
' "state_topic": "test_topic2",'
|
|
|
|
' "command_topic": "command_topic",'
|
|
|
|
' "availability_topic": "availability_topic2" }'
|
|
|
|
)
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_discovery_update(hass, mqtt_mock, caplog, lock.DOMAIN, data1, data2)
|
2019-01-14 20:01:42 +00:00
|
|
|
|
2020-03-09 16:40:00 +00:00
|
|
|
|
|
|
|
async def test_discovery_broken(hass, mqtt_mock, caplog):
|
|
|
|
"""Test handling of bad discovery message."""
|
|
|
|
data1 = '{ "name": "Beer" }'
|
|
|
|
data2 = '{ "name": "Milk",' ' "command_topic": "test_topic" }'
|
|
|
|
await help_test_discovery_broken(hass, mqtt_mock, caplog, lock.DOMAIN, data1, data2)
|
2019-01-14 20:01:42 +00:00
|
|
|
|
|
|
|
|
2020-03-17 07:09:19 +00:00
|
|
|
async def test_entity_device_info_with_connection(hass, mqtt_mock):
|
|
|
|
"""Test MQTT lock device registry integration."""
|
|
|
|
await help_test_entity_device_info_with_connection(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-12-19 18:26:07 +00:00
|
|
|
async def test_entity_device_info_with_identifier(hass, mqtt_mock):
|
|
|
|
"""Test MQTT lock device registry integration."""
|
2020-03-09 16:40:00 +00:00
|
|
|
await help_test_entity_device_info_with_identifier(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
2020-03-09 16:40:00 +00:00
|
|
|
)
|
2019-01-14 20:01:42 +00:00
|
|
|
|
|
|
|
|
2019-01-27 16:42:45 +00:00
|
|
|
async def test_entity_device_info_update(hass, mqtt_mock):
|
|
|
|
"""Test device registry update."""
|
2020-03-11 16:34:19 +00:00
|
|
|
await help_test_entity_device_info_update(
|
2020-03-17 07:09:19 +00:00
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
2020-03-11 16:34:19 +00:00
|
|
|
)
|
2019-01-27 16:42:45 +00:00
|
|
|
|
|
|
|
|
2020-03-12 01:00:47 +00:00
|
|
|
async def test_entity_device_info_remove(hass, mqtt_mock):
|
|
|
|
"""Test device registry remove."""
|
2020-03-17 07:09:19 +00:00
|
|
|
await help_test_entity_device_info_remove(
|
|
|
|
hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG
|
|
|
|
)
|
2020-03-12 01:00:47 +00:00
|
|
|
|
|
|
|
|
2019-01-14 20:01:42 +00:00
|
|
|
async def test_entity_id_update(hass, mqtt_mock):
|
|
|
|
"""Test MQTT subscriptions are managed when entity_id is updated."""
|
2020-03-17 07:09:19 +00:00
|
|
|
await help_test_entity_id_update(hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG)
|