Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set ZHA device availability on new join #21066

Merged
merged 2 commits into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions homeassistant/components/zha/core/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ async def async_device_initialized(self, device, is_new_join):
device_entity = _create_device_entity(zha_device)
await self._component.async_add_entities([device_entity])

if is_new_join:
zha_device.update_available(True)

async def _async_process_endpoint(
self, endpoint_id, endpoint, discovery_infos, device, zha_device,
is_new_join):
Expand Down
3 changes: 1 addition & 2 deletions tests/components/zha/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Common test objects."""
import time
from unittest.mock import patch, Mock
from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.components.zha.core.helpers import convert_ieee
from homeassistant.components.zha.core.const import (
DATA_ZHA, DATA_ZHA_CONFIG, DATA_ZHA_DISPATCHERS, DATA_ZHA_BRIDGE_ID
Expand Down Expand Up @@ -191,4 +190,4 @@ async def async_test_device_join(
cluster = zigpy_device.endpoints.get(1).in_clusters[cluster_id]
entity_id = make_entity_id(
domain, zigpy_device, cluster, use_suffix=device_type is None)
assert hass.states.get(entity_id).state == STATE_UNAVAILABLE
assert hass.states.get(entity_id) is not None