Fix history YAML deprecation (#92238)
parent
06c4da2bb6
commit
acc4b001cd
|
@ -12,6 +12,7 @@ from homeassistant.components import frontend
|
|||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.recorder import get_instance, history
|
||||
from homeassistant.components.recorder.util import session_scope
|
||||
from homeassistant.const import CONF_EXCLUDE, CONF_INCLUDE
|
||||
from homeassistant.core import HomeAssistant, valid_entity_id
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entityfilter import INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA
|
||||
|
@ -27,16 +28,16 @@ CONF_ORDER = "use_include_order"
|
|||
_ONE_DAY = timedelta(days=1)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
vol.All(
|
||||
cv.deprecated(DOMAIN),
|
||||
{
|
||||
DOMAIN: vol.All(
|
||||
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA.extend(
|
||||
{vol.Optional(CONF_ORDER, default=False): cv.boolean}
|
||||
),
|
||||
)
|
||||
},
|
||||
),
|
||||
{
|
||||
DOMAIN: vol.All(
|
||||
cv.deprecated(CONF_INCLUDE),
|
||||
cv.deprecated(CONF_EXCLUDE),
|
||||
cv.deprecated(CONF_ORDER),
|
||||
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA.extend(
|
||||
{vol.Optional(CONF_ORDER, default=False): cv.boolean}
|
||||
),
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
|
|
|
@ -406,7 +406,10 @@ async def test_fetch_period_api(
|
|||
|
||||
|
||||
async def test_fetch_period_api_with_use_include_order(
|
||||
recorder_mock: Recorder, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test the fetch period view for history with include order."""
|
||||
await async_setup_component(
|
||||
|
@ -418,6 +421,8 @@ async def test_fetch_period_api_with_use_include_order(
|
|||
)
|
||||
assert response.status == HTTPStatus.OK
|
||||
|
||||
assert "The 'use_include_order' option is deprecated" in caplog.text
|
||||
|
||||
|
||||
async def test_fetch_period_api_with_minimal_response(
|
||||
recorder_mock: Recorder, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
|
@ -472,7 +477,10 @@ async def test_fetch_period_api_with_no_timestamp(
|
|||
|
||||
|
||||
async def test_fetch_period_api_with_include_order(
|
||||
recorder_mock: Recorder, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test the fetch period view for history."""
|
||||
await async_setup_component(
|
||||
|
@ -492,6 +500,9 @@ async def test_fetch_period_api_with_include_order(
|
|||
)
|
||||
assert response.status == HTTPStatus.OK
|
||||
|
||||
assert "The 'use_include_order' option is deprecated" in caplog.text
|
||||
assert "The 'include' option is deprecated" in caplog.text
|
||||
|
||||
|
||||
async def test_entity_ids_limit_via_api(
|
||||
recorder_mock: Recorder, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
|
|
Loading…
Reference in New Issue