Handle disabled devices (#25625)
parent
7168dd6cec
commit
56ca0edaa7
|
@ -304,7 +304,7 @@ class UniFiDeviceTracker(ScannerEntity):
|
||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return if controller is available."""
|
"""Return if controller is available."""
|
||||||
return self.controller.available
|
return not self.device.disabled and self.controller.available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/components/unifi",
|
"documentation": "https://www.home-assistant.io/components/unifi",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aiounifi==8"
|
"aiounifi==9"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
|
|
@ -169,7 +169,7 @@ aiopvapi==1.6.14
|
||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==8
|
aiounifi==9
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==1.0.0
|
aiowwlln==1.0.0
|
||||||
|
|
|
@ -68,7 +68,7 @@ aionotion==1.1.0
|
||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==8
|
aiounifi==9
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==1.0.0
|
aiowwlln==1.0.0
|
||||||
|
|
|
@ -203,6 +203,16 @@ async def test_tracked_devices(hass, mock_controller):
|
||||||
device_1 = hass.states.get("device_tracker.device_1")
|
device_1 = hass.states.get("device_tracker.device_1")
|
||||||
assert device_1.state == "home"
|
assert device_1.state == "home"
|
||||||
|
|
||||||
|
device_1_copy = copy(DEVICE_1)
|
||||||
|
device_1_copy["disabled"] = True
|
||||||
|
mock_controller.mock_client_responses.append({})
|
||||||
|
mock_controller.mock_device_responses.append([device_1_copy])
|
||||||
|
await mock_controller.async_update()
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
device_1 = hass.states.get("device_tracker.device_1")
|
||||||
|
assert device_1.state == "unavailable"
|
||||||
|
|
||||||
|
|
||||||
async def test_restoring_client(hass, mock_controller):
|
async def test_restoring_client(hass, mock_controller):
|
||||||
"""Test the update_items function with some clients."""
|
"""Test the update_items function with some clients."""
|
||||||
|
|
Loading…
Reference in New Issue