Allow legacy nest integration with no configuration.yaml (#74222)
This commit is contained in:
parent
48c5aab5ee
commit
0cf922cc4e
3 changed files with 16 additions and 3 deletions
|
@ -177,7 +177,7 @@ class SignalUpdateCallback:
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Nest from a config entry with dispatch between old/new flows."""
|
"""Set up Nest from a config entry with dispatch between old/new flows."""
|
||||||
config_mode = config_flow.get_config_mode(hass)
|
config_mode = config_flow.get_config_mode(hass)
|
||||||
if config_mode == config_flow.ConfigMode.LEGACY:
|
if DATA_SDM not in entry.data or config_mode == config_flow.ConfigMode.LEGACY:
|
||||||
return await async_setup_legacy_entry(hass, entry)
|
return await async_setup_legacy_entry(hass, entry)
|
||||||
|
|
||||||
if config_mode == config_flow.ConfigMode.SDM:
|
if config_mode == config_flow.ConfigMode.SDM:
|
||||||
|
|
|
@ -147,7 +147,17 @@ TEST_CONFIG_LEGACY = NestTestConfig(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
credential=None,
|
)
|
||||||
|
TEST_CONFIG_ENTRY_LEGACY = NestTestConfig(
|
||||||
|
config_entry_data={
|
||||||
|
"auth_implementation": "local",
|
||||||
|
"tokens": {
|
||||||
|
"expires_at": time.time() + 86400,
|
||||||
|
"access_token": {
|
||||||
|
"token": "some-token",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import MagicMock, PropertyMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .common import TEST_CONFIG_LEGACY
|
from .common import TEST_CONFIG_ENTRY_LEGACY, TEST_CONFIG_LEGACY
|
||||||
|
|
||||||
DOMAIN = "nest"
|
DOMAIN = "nest"
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ def make_thermostat():
|
||||||
return device
|
return device
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"nest_test_config", [TEST_CONFIG_LEGACY, TEST_CONFIG_ENTRY_LEGACY]
|
||||||
|
)
|
||||||
async def test_thermostat(hass, setup_base_platform):
|
async def test_thermostat(hass, setup_base_platform):
|
||||||
"""Test simple initialization for thermostat entities."""
|
"""Test simple initialization for thermostat entities."""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue