1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add generic_thermostat unique ID parameter (#46399)

* Add generic_thermostat unique ID parameter

* Add tests for unique id

* Fix flake8
This commit is contained in:
Czapla
2021-02-11 20:46:58 +01:00
committed by GitHub
parent 26e7916367
commit 14a64ea970
2 changed files with 38 additions and 0 deletions

View File

@@ -159,6 +159,33 @@ async def test_heater_switch(hass, setup_comp_1):
assert STATE_ON == hass.states.get(heater_switch).state
async def test_unique_id(hass, setup_comp_1):
"""Test heater switching input_boolean."""
unique_id = "some_unique_id"
_setup_sensor(hass, 18)
_setup_switch(hass, True)
assert await async_setup_component(
hass,
DOMAIN,
{
"climate": {
"platform": "generic_thermostat",
"name": "test",
"heater": ENT_SWITCH,
"target_sensor": ENT_SENSOR,
"unique_id": unique_id,
}
},
)
await hass.async_block_till_done()
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get(ENTITY)
assert entry
assert entry.unique_id == unique_id
def _setup_sensor(hass, temp):
"""Set up the test sensor."""
hass.states.async_set(ENT_SENSOR, temp)