Add unique_id to mqtt camera (#16569)
* Add unique_id to mqtt camera * Remove whitespaces * Add test for unique_id * Add blank line
This commit is contained in:
1 parent
3bfe9e757e
commit
a0a54dfd5b
2 files changed
+33
-1
No files matched your search
@@ -29,3 +29,26 @@ def test_run_camera_setup(hass, aiohttp_client):
|
||||
assert resp.status == 200
|
||||
body = yield from resp.text()
|
||||
assert body == 'beer'
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_unique_id(hass):
|
||||
"""Test unique id option only creates one camera per unique_id."""
|
||||
yield from async_mock_mqtt_component(hass)
|
||||
yield from async_setup_component(hass, 'camera', {
|
||||
'camera': [{
|
||||
'platform': 'mqtt',
|
||||
'name': 'Test Camera 1',
|
||||
'topic': 'test-topic',
|
||||
'unique_id': 'TOTALLY_UNIQUE'
|
||||
}, {
|
||||
'platform': 'mqtt',
|
||||
'name': 'Test Camera 2',
|
||||
'topic': 'test-topic',
|
||||
'unique_id': 'TOTALLY_UNIQUE'
|
||||
}]
|
||||
})
|
||||
|
||||
async_fire_mqtt_message(hass, 'test-topic', 'payload')
|
||||
yield from hass.async_block_till_done()
|
||||
assert len(hass.states.async_all()) == 1
|
||||
Reference in new issue
Block a user