1
mirror of https://github.com/home-assistant/core synced 2024-07-30 21:18:57 +02:00

Fix issue when data is None (#53875)

This commit is contained in:
Joakim Sørensen 2021-08-02 19:35:11 +02:00 committed by GitHub
parent 3bf06de363
commit c3d623a37e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,8 @@ from .data import async_get_manager
async def is_configured(hass: HomeAssistant) -> bool:
"""Return a boolean to indicate if energy is configured."""
manager = await async_get_manager(hass)
if manager.data is None:
return False
return bool(manager.data != manager.default_preferences())

View File

@ -30,6 +30,7 @@ async def test_get_preferences_no_data(hass, hass_ws_client) -> None:
async def test_get_preferences_default(hass, hass_ws_client, hass_storage) -> None:
"""Test we get preferences."""
assert not await is_configured(hass)
manager = await data.async_get_manager(hass)
manager.data = data.EnergyManager.default_preferences()
client = await hass_ws_client(hass)