mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Allow legacy nest integration with no configuration.yaml (#74222)
This commit is contained in:
parent
48c5aab5ee
commit
0cf922cc4e
@ -177,7 +177,7 @@ class SignalUpdateCallback:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Nest from a config entry with dispatch between old/new flows."""
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
from .common import TEST_CONFIG_LEGACY
|
||||
from .common import TEST_CONFIG_ENTRY_LEGACY, TEST_CONFIG_LEGACY
|
||||
|
||||
DOMAIN = "nest"
|
||||
|
||||
@ -33,6 +33,9 @@ def make_thermostat():
|
||||
return device
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"nest_test_config", [TEST_CONFIG_LEGACY, TEST_CONFIG_ENTRY_LEGACY]
|
||||
)
|
||||
async def test_thermostat(hass, setup_base_platform):
|
||||
"""Test simple initialization for thermostat entities."""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user