Speed up responding to states being polled via API (#99621)
* Speed up responding to states being polled via API Switch to using `as_dict_json` to avoid serializing states over and over when the states api is polled since the mobile app is already building the cache as it also polls the states via the websocket_api * Speed up responding to states being polled via API Switch to using `as_dict_json` to avoid serializing states over and over when the states api is polled since the mobile app is already building the cache as it also polls the states via the websocket_api * fix json * cover
This commit is contained in:
parent
47c20495bd
commit
d2a52230ff
2 changed files with 22 additions and 11 deletions
|
@ -575,11 +575,13 @@ async def test_states(
|
|||
) -> None:
|
||||
"""Test fetching all states as admin."""
|
||||
hass.states.async_set("test.entity", "hello")
|
||||
hass.states.async_set("test.entity2", "hello")
|
||||
resp = await mock_api_client.get(const.URL_API_STATES)
|
||||
assert resp.status == HTTPStatus.OK
|
||||
json = await resp.json()
|
||||
assert len(json) == 1
|
||||
assert len(json) == 2
|
||||
assert json[0]["entity_id"] == "test.entity"
|
||||
assert json[1]["entity_id"] == "test.entity2"
|
||||
|
||||
|
||||
async def test_states_view_filters(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue