Skip to content

Commit f236e8d

Browse files
authored
Merge pull request #199 from puddly/rc
0.18.0 Release
2 parents 6f9b0bf + f092729 commit f236e8d

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

tests/test_application.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,12 @@ async def test_start_network(app, proto_ver, nwk_state, error):
252252
with patch.object(application.DeconzDevice, "initialize", AsyncMock()):
253253
await app.start_network()
254254
assert app.load_network_info.await_count == 1
255+
assert app._change_network_state.await_count == 1
255256

256-
if nwk_state != deconz_api.NetworkState.CONNECTED:
257-
assert app._change_network_state.await_count == 1
258-
assert (
259-
app._change_network_state.await_args_list[0][0][0]
260-
== deconz_api.NetworkState.CONNECTED
261-
)
262-
else:
263-
assert app._change_network_state.await_count == 0
257+
assert (
258+
app._change_network_state.await_args_list[0][0][0]
259+
== deconz_api.NetworkState.CONNECTED
260+
)
264261

265262
if proto_ver >= application.PROTO_VER_NEIGBOURS:
266263
assert app.restore_neighbours.await_count == 1

zigpy_deconz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# coding: utf-8
44
MAJOR_VERSION = 0
5-
MINOR_VERSION = 17
5+
MINOR_VERSION = 18
66
PATCH_VERSION = "0"
77
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
88
__version__ = f"{__short_version__}.{PATCH_VERSION}"

zigpy_deconz/zigbee/application.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ async def _reset_watchdog(self):
8080
await self._api.write_parameter(
8181
NetworkParameter.watchdog_ttl, self._config[CONF_WATCHDOG_TTL]
8282
)
83-
except (asyncio.TimeoutError, zigpy.exceptions.ZigbeeException):
84-
LOGGER.warning("No watchdog response")
83+
except Exception as e:
84+
LOGGER.warning("Failed to reset watchdog", exc_info=e)
85+
8586
await asyncio.sleep(self._config[CONF_WATCHDOG_TTL] * 0.75)
8687

8788
async def connect(self):
@@ -95,15 +96,7 @@ async def disconnect(self):
9596
if self._reset_watchdog_task is not None:
9697
self._reset_watchdog_task.cancel()
9798

98-
if self._api is None:
99-
return
100-
101-
try:
102-
if self._api.protocol_version >= PROTO_VER_WATCHDOG:
103-
await self._api.write_parameter(NetworkParameter.watchdog_ttl, 1)
104-
except zigpy_deconz.exception.CommandError:
105-
pass
106-
finally:
99+
if self._api is not None:
107100
self._api.close()
108101

109102
async def permit_with_key(self, node: t.EUI64, code: bytes, time_s=60):
@@ -113,13 +106,10 @@ async def start_network(self):
113106
await self.register_endpoints()
114107
await self.load_network_info(load_devices=False)
115108

116-
device_state, _, _ = await self._api.device_state()
117-
118-
if device_state.network_state != NetworkState.CONNECTED:
119-
try:
120-
await self._change_network_state(NetworkState.CONNECTED)
121-
except asyncio.TimeoutError as e:
122-
raise FormationFailure() from e
109+
try:
110+
await self._change_network_state(NetworkState.CONNECTED)
111+
except asyncio.TimeoutError as e:
112+
raise FormationFailure() from e
123113

124114
coordinator = await DeconzDevice.new(
125115
self,

0 commit comments

Comments
 (0)