Skip to content

Commit

Permalink
Bump ZHA dependencies (#105661)
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly authored and frenck committed Dec 13, 2023
1 parent db52b9b commit ebb54d7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 69 deletions.
1 change: 0 additions & 1 deletion homeassistant/components/zha/core/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
CONF_ENABLE_QUIRKS = "enable_quirks"
CONF_RADIO_TYPE = "radio_type"
CONF_USB_PATH = "usb_path"
CONF_USE_THREAD = "use_thread"
CONF_ZIGPY = "zigpy_config"

CONF_CONSIDER_UNAVAILABLE_MAINS = "consider_unavailable_mains"
Expand Down
10 changes: 0 additions & 10 deletions homeassistant/components/zha/core/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
ATTR_SIGNATURE,
ATTR_TYPE,
CONF_RADIO_TYPE,
CONF_USE_THREAD,
CONF_ZIGPY,
DEBUG_COMP_BELLOWS,
DEBUG_COMP_ZHA,
Expand Down Expand Up @@ -158,15 +157,6 @@ def get_application_controller_data(self) -> tuple[ControllerApplication, dict]:
if CONF_NWK_VALIDATE_SETTINGS not in app_config:
app_config[CONF_NWK_VALIDATE_SETTINGS] = True

# The bellows UART thread sometimes propagates a cancellation into the main Core
# event loop, when a connection to a TCP coordinator fails in a specific way
if (
CONF_USE_THREAD not in app_config
and radio_type is RadioType.ezsp
and app_config[CONF_DEVICE][CONF_DEVICE_PATH].startswith("socket://")
):
app_config[CONF_USE_THREAD] = False

# Local import to avoid circular dependencies
# pylint: disable-next=import-outside-toplevel
from homeassistant.components.homeassistant_hardware.silabs_multiprotocol_addon import (
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/zha/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"universal_silabs_flasher"
],
"requirements": [
"bellows==0.37.1",
"bellows==0.37.3",
"pyserial==3.5",
"pyserial-asyncio==0.6",
"zha-quirks==0.0.107",
"zigpy-deconz==0.22.0",
"zigpy==0.60.0",
"zigpy-xbee==0.20.0",
"zigpy-deconz==0.22.2",
"zigpy==0.60.1",
"zigpy-xbee==0.20.1",
"zigpy-zigate==0.12.0",
"zigpy-znp==0.12.0",
"universal-silabs-flasher==0.0.15",
Expand Down
2 changes: 0 additions & 2 deletions homeassistant/components/zha/radio_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
from typing import Any, Self

from bellows.config import CONF_USE_THREAD
import voluptuous as vol
from zigpy.application import ControllerApplication
import zigpy.backups
Expand Down Expand Up @@ -175,7 +174,6 @@ async def connect_zigpy_app(self) -> ControllerApplication:
app_config[CONF_DATABASE] = database_path
app_config[CONF_DEVICE] = self.device_settings
app_config[CONF_NWK_BACKUP_ENABLED] = False
app_config[CONF_USE_THREAD] = False
app_config = self.radio_type.controller.SCHEMA(app_config)

app = await self.radio_type.controller.new(
Expand Down
8 changes: 4 additions & 4 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ beautifulsoup4==4.12.2
# beewi-smartclim==0.0.10

# homeassistant.components.zha
bellows==0.37.1
bellows==0.37.3

# homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.14.6
Expand Down Expand Up @@ -2825,10 +2825,10 @@ zhong-hong-hvac==1.0.9
ziggo-mediabox-xl==1.1.0

# homeassistant.components.zha
zigpy-deconz==0.22.0
zigpy-deconz==0.22.2

# homeassistant.components.zha
zigpy-xbee==0.20.0
zigpy-xbee==0.20.1

# homeassistant.components.zha
zigpy-zigate==0.12.0
Expand All @@ -2837,7 +2837,7 @@ zigpy-zigate==0.12.0
zigpy-znp==0.12.0

# homeassistant.components.zha
zigpy==0.60.0
zigpy==0.60.1

# homeassistant.components.zoneminder
zm-py==0.5.2
Expand Down
8 changes: 4 additions & 4 deletions requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ base36==0.1.1
beautifulsoup4==4.12.2

# homeassistant.components.zha
bellows==0.37.1
bellows==0.37.3

# homeassistant.components.bmw_connected_drive
bimmer-connected[china]==0.14.6
Expand Down Expand Up @@ -2114,10 +2114,10 @@ zeversolar==0.3.1
zha-quirks==0.0.107

# homeassistant.components.zha
zigpy-deconz==0.22.0
zigpy-deconz==0.22.2

# homeassistant.components.zha
zigpy-xbee==0.20.0
zigpy-xbee==0.20.1

# homeassistant.components.zha
zigpy-zigate==0.12.0
Expand All @@ -2126,7 +2126,7 @@ zigpy-zigate==0.12.0
zigpy-znp==0.12.0

# homeassistant.components.zha
zigpy==0.60.0
zigpy==0.60.1

# homeassistant.components.zwave_js
zwave-js-server-python==0.54.0
Expand Down
45 changes: 1 addition & 44 deletions tests/components/zha/test_gateway.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Test ZHA Gateway."""
import asyncio
from unittest.mock import MagicMock, patch
from unittest.mock import patch

import pytest
from zigpy.application import ControllerApplication
import zigpy.profiles.zha as zha
import zigpy.zcl.clusters.general as general
import zigpy.zcl.clusters.lighting as lighting
Expand Down Expand Up @@ -223,48 +222,6 @@ async def test_gateway_create_group_with_id(
assert zha_group.group_id == 0x1234


@patch(
"homeassistant.components.zha.core.gateway.ZHAGateway.async_load_devices",
MagicMock(),
)
@patch(
"homeassistant.components.zha.core.gateway.ZHAGateway.async_load_groups",
MagicMock(),
)
@pytest.mark.parametrize(
("device_path", "thread_state", "config_override"),
[
("/dev/ttyUSB0", True, {}),
("socket://192.168.1.123:9999", False, {}),
("socket://192.168.1.123:9999", True, {"use_thread": True}),
],
)
async def test_gateway_initialize_bellows_thread(
device_path: str,
thread_state: bool,
config_override: dict,
hass: HomeAssistant,
zigpy_app_controller: ControllerApplication,
config_entry: MockConfigEntry,
) -> None:
"""Test ZHA disabling the UART thread when connecting to a TCP coordinator."""
config_entry.data = dict(config_entry.data)
config_entry.data["device"]["path"] = device_path
config_entry.add_to_hass(hass)

zha_gateway = ZHAGateway(hass, {"zigpy_config": config_override}, config_entry)

with patch(
"bellows.zigbee.application.ControllerApplication.new",
return_value=zigpy_app_controller,
) as mock_new:
await zha_gateway.async_initialize()

mock_new.mock_calls[-1].kwargs["config"]["use_thread"] is thread_state

await zha_gateway.shutdown()


@pytest.mark.parametrize(
("device_path", "config_override", "expected_channel"),
[
Expand Down

0 comments on commit ebb54d7

Please sign in to comment.