Improve coordinator logic in Tessie to allow sleep (#107988)

* Poll status before state

* Tests
This commit is contained in:
Brett Adams 2024-01-19 02:40:36 +10:00 committed by GitHub
parent cdb798bec0
commit 32b0bf6b4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 60 additions and 31 deletions

View file

@ -6,7 +6,7 @@ from unittest.mock import patch
from aiohttp import ClientConnectionError, ClientResponseError
from aiohttp.client import RequestInfo
from homeassistant.components.tessie.const import DOMAIN
from homeassistant.components.tessie.const import DOMAIN, TessieStatus
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
@ -14,7 +14,9 @@ from tests.common import MockConfigEntry, load_json_object_fixture
TEST_STATE_OF_ALL_VEHICLES = load_json_object_fixture("vehicles.json", DOMAIN)
TEST_VEHICLE_STATE_ONLINE = load_json_object_fixture("online.json", DOMAIN)
TEST_VEHICLE_STATE_ASLEEP = load_json_object_fixture("asleep.json", DOMAIN)
TEST_VEHICLE_STATUS_AWAKE = {"status": TessieStatus.AWAKE}
TEST_VEHICLE_STATUS_ASLEEP = {"status": TessieStatus.ASLEEP}
TEST_RESPONSE = {"result": True}
TEST_RESPONSE_ERROR = {"result": False, "reason": "reason why"}