Add ZHA group API (#29641)
* add skeleton to retrieve zigbee groups * get single group * add a group * return group members with group * add comment * fix group members * add function to add device to group * add group members * add remove from group method * add api to remove members from group * add remove groups method * clean up group add and remove * fix remove group * fix remove groups * add api to get only groupable devices * change var init * add tests * address review comment
This commit is contained in:
1 parent
7f948594eb
commit
1222aa8c56
6 files changed
+461
-3
No files matched your search
@@ -1,7 +1,10 @@
|
||||
"""Test configuration for the ZHA component."""
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import zigpy
|
||||
from zigpy.application import ControllerApplication
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.zha.core.const import COMPONENTS, DATA_ZHA, DOMAIN
|
||||
@@ -12,6 +15,9 @@ from homeassistant.helpers.device_registry import async_get_registry as get_dev_
|
||||
|
||||
from .common import async_setup_entry
|
||||
|
||||
FIXTURE_GRP_ID = 0x1001
|
||||
FIXTURE_GRP_NAME = "fixture group"
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry")
|
||||
def config_entry_fixture(hass):
|
||||
@@ -43,6 +49,11 @@ async def zha_gateway_fixture(hass, config_entry):
|
||||
gateway = ZHAGateway(hass, {}, config_entry)
|
||||
gateway.zha_storage = zha_storage
|
||||
gateway.ha_device_registry = dev_reg
|
||||
gateway.application_controller = mock.MagicMock(spec_set=ControllerApplication)
|
||||
groups = zigpy.group.Groups(gateway.application_controller)
|
||||
groups.listener_event = mock.MagicMock()
|
||||
groups.add_group(FIXTURE_GRP_ID, FIXTURE_GRP_NAME, suppress_event=True)
|
||||
gateway.application_controller.groups = groups
|
||||
return gateway
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user