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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user