Gracefully handle bond API errors and timeouts through available state (#38137)

* Gracefully handle API errors and timeouts through available state

* Gracefully handle API errors and timeouts through available state
This commit is contained in:
Eugene Prystupa authored and GitHub committed 2020-07-24 15:14:47 -05:00
1 parent 21db4a4160
commit 69203b5373
7 files changed
+109 -11

No files matched your search

+13 -1
View File
@@ -10,7 +10,12 @@ from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_O
from homeassistant.helpers.entity_registry import EntityRegistry
from homeassistant.util import utcnow
from .common import patch_bond_action, patch_bond_device_state, setup_platform
from .common import (
help_test_entity_available,
patch_bond_action,
patch_bond_device_state,
setup_platform,
)
from tests.common import async_fire_time_changed
@@ -162,3 +167,10 @@ async def test_flame_converted_to_brightness(hass: core.HomeAssistant):
await hass.async_block_till_done()
assert hass.states.get("light.name_1").attributes[ATTR_BRIGHTNESS] == 128
async def test_light_available(hass: core.HomeAssistant):
"""Tests that available state is updated based on API errors."""
await help_test_entity_available(
hass, LIGHT_DOMAIN, ceiling_fan("name-1"), "light.name_1"
)