1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Fix WUnderground duplicate entity ids (#13285)

* Fix WUnderground duplicate entity ids

* Entity Namespace
This commit is contained in:
Otto Winter
2018-03-17 13:14:53 +01:00
committed by GitHub
parent f5093b474a
commit 3442b6741d
4 changed files with 45 additions and 8 deletions

View File

@@ -143,3 +143,23 @@ def test_invalid_data(hass, aioclient_mock):
for condition in VALID_CONFIG['monitored_conditions']:
state = hass.states.get('sensor.pws_' + condition)
assert state.state == STATE_UNKNOWN
async def test_entity_id_with_multiple_stations(hass, aioclient_mock):
"""Test not generating duplicate entity ids with multiple stations."""
aioclient_mock.get(URL, text=load_fixture('wunderground-valid.json'))
config = [
VALID_CONFIG,
{**VALID_CONFIG, 'entity_namespace': 'hi'}
]
await async_setup_component(hass, 'sensor', {'sensor': config})
await hass.async_block_till_done()
state = hass.states.get('sensor.pws_weather')
assert state is not None
assert state.state == 'Clear'
state = hass.states.get('sensor.hi_weather')
assert state is not None
assert state.state == 'Clear'