Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/zha/core/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ async def shutdown(self):
_LOGGER.debug("Shutting down ZHA ControllerApplication")
for unsubscribe in self._unsubs:
unsubscribe()
await self.application_controller.shutdown()
await self.application_controller.pre_shutdown()


@callback
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"zha-quirks==0.0.45",
"zigpy-cc==0.5.2",
"zigpy-deconz==0.11.0",
"zigpy==0.26.0",
"zigpy==0.27.0",
"zigpy-xbee==0.13.0",
"zigpy-zigate==0.6.2",
"zigpy-znp==0.2.2"
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ zigpy-zigate==0.6.2
zigpy-znp==0.2.2

# homeassistant.components.zha
zigpy==0.26.0
zigpy==0.27.0

# homeassistant.components.zoneminder
zm-py==0.4.0
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1131,4 +1131,4 @@ zigpy-zigate==0.6.2
zigpy-znp==0.2.2

# homeassistant.components.zha
zigpy==0.26.0
zigpy==0.27.0
37 changes: 18 additions & 19 deletions tests/components/zha/test_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
send_attributes_report,
)

from tests.async_mock import AsyncMock, MagicMock, call, patch
from tests.async_mock import AsyncMock, MagicMock, patch
from tests.common import async_capture_events, mock_coro, mock_restore_cache


Expand Down Expand Up @@ -144,9 +144,10 @@ async def get_chan_attr(*args, **kwargs):
DOMAIN, SERVICE_CLOSE_COVER, {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
assert cluster.request.call_args == call(
False, 0x1, (), expect_reply=True, manufacturer=None, tsn=None
)
assert cluster.request.call_args[0][0] is False
assert cluster.request.call_args[0][1] == 0x01
assert cluster.request.call_args[0][2] == ()
assert cluster.request.call_args[1]["expect_reply"] is True

# open from UI
with patch(
Expand All @@ -156,9 +157,10 @@ async def get_chan_attr(*args, **kwargs):
DOMAIN, SERVICE_OPEN_COVER, {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
assert cluster.request.call_args == call(
False, 0x0, (), expect_reply=True, manufacturer=None, tsn=None
)
assert cluster.request.call_args[0][0] is False
assert cluster.request.call_args[0][1] == 0x00
assert cluster.request.call_args[0][2] == ()
assert cluster.request.call_args[1]["expect_reply"] is True

# set position UI
with patch(
Expand All @@ -171,15 +173,11 @@ async def get_chan_attr(*args, **kwargs):
blocking=True,
)
assert cluster.request.call_count == 1
assert cluster.request.call_args == call(
False,
0x5,
(zigpy.types.uint8_t,),
53,
expect_reply=True,
manufacturer=None,
tsn=None,
)
assert cluster.request.call_args[0][0] is False
assert cluster.request.call_args[0][1] == 0x05
assert cluster.request.call_args[0][2] == (zigpy.types.uint8_t,)
assert cluster.request.call_args[0][3] == 53
assert cluster.request.call_args[1]["expect_reply"] is True

# stop from UI
with patch(
Expand All @@ -189,9 +187,10 @@ async def get_chan_attr(*args, **kwargs):
DOMAIN, SERVICE_STOP_COVER, {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
assert cluster.request.call_args == call(
False, 0x2, (), expect_reply=True, manufacturer=None, tsn=None
)
assert cluster.request.call_args[0][0] is False
assert cluster.request.call_args[0][1] == 0x02
assert cluster.request.call_args[0][2] == ()
assert cluster.request.call_args[1]["expect_reply"] is True

# test rejoin
await async_test_rejoin(hass, zigpy_cover_device, [cluster], (1,))
Expand Down
1 change: 1 addition & 0 deletions tests/components/zha/test_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ async def test_devices(
0,
expect_reply=True,
manufacturer=None,
tries=1,
tsn=None,
)

Expand Down
13 changes: 8 additions & 5 deletions tests/components/zha/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ async def async_test_on_off_from_hass(hass, cluster, entity_id):
assert cluster.request.call_count == 1
assert cluster.request.await_count == 1
assert cluster.request.call_args == call(
False, ON, (), expect_reply=True, manufacturer=None, tsn=None
False, ON, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)

await async_test_off_from_hass(hass, cluster, entity_id)
Expand All @@ -340,7 +340,7 @@ async def async_test_off_from_hass(hass, cluster, entity_id):
assert cluster.request.call_count == 1
assert cluster.request.await_count == 1
assert cluster.request.call_args == call(
False, OFF, (), expect_reply=True, manufacturer=None, tsn=None
False, OFF, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)


Expand All @@ -360,7 +360,7 @@ async def async_test_level_on_off_from_hass(
assert level_cluster.request.call_count == 0
assert level_cluster.request.await_count == 0
assert on_off_cluster.request.call_args == call(
False, ON, (), expect_reply=True, manufacturer=None, tsn=None
False, ON, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)
on_off_cluster.request.reset_mock()
level_cluster.request.reset_mock()
Expand All @@ -373,7 +373,7 @@ async def async_test_level_on_off_from_hass(
assert level_cluster.request.call_count == 1
assert level_cluster.request.await_count == 1
assert on_off_cluster.request.call_args == call(
False, ON, (), expect_reply=True, manufacturer=None, tsn=None
False, ON, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)
assert level_cluster.request.call_args == call(
False,
Expand All @@ -383,6 +383,7 @@ async def async_test_level_on_off_from_hass(
100.0,
expect_reply=True,
manufacturer=None,
tries=1,
tsn=None,
)
on_off_cluster.request.reset_mock()
Expand All @@ -396,7 +397,7 @@ async def async_test_level_on_off_from_hass(
assert level_cluster.request.call_count == 1
assert level_cluster.request.await_count == 1
assert on_off_cluster.request.call_args == call(
False, ON, (), expect_reply=True, manufacturer=None, tsn=None
False, ON, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)
assert level_cluster.request.call_args == call(
False,
Expand All @@ -406,6 +407,7 @@ async def async_test_level_on_off_from_hass(
1,
expect_reply=True,
manufacturer=None,
tries=1,
tsn=None,
)
on_off_cluster.request.reset_mock()
Expand Down Expand Up @@ -445,6 +447,7 @@ async def async_test_flash_from_hass(hass, cluster, entity_id, flash):
0,
expect_reply=True,
manufacturer=None,
tries=1,
tsn=None,
)

Expand Down
4 changes: 2 additions & 2 deletions tests/components/zha/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async def test_switch(hass, zha_device_joined_restored, zigpy_device):
)
assert len(cluster.request.mock_calls) == 1
assert cluster.request.call_args == call(
False, ON, (), expect_reply=True, manufacturer=None, tsn=None
False, ON, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)

# turn off from HA
Expand All @@ -150,7 +150,7 @@ async def test_switch(hass, zha_device_joined_restored, zigpy_device):
)
assert len(cluster.request.mock_calls) == 1
assert cluster.request.call_args == call(
False, OFF, (), expect_reply=True, manufacturer=None, tsn=None
False, OFF, (), expect_reply=True, manufacturer=None, tries=1, tsn=None
)

# test joining a new switch to the network and HA
Expand Down