Skip to content

Commit 09cd1b3

Browse files
authored
Revert watchdog back to once every 7.5 minutes (#239)
* Revert watchdog back to once every 7.5 minutes * Ensure unit tests reflect commands that are now sent
1 parent 83872b1 commit 09cd1b3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/test_application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ async def test_reset_watchdog(app):
337337
app._api.write_parameter = AsyncMock()
338338

339339
await app._watchdog_feed()
340-
assert len(app._api.get_device_state.mock_calls) == 1
340+
assert len(app._api.get_device_state.mock_calls) == 0
341341
assert len(app._api.write_parameter.mock_calls) == 1
342342

343343
app._api.protocol_version = application.PROTO_VER_WATCHDOG - 1

zigpy_deconz/zigbee/application.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class ControllerApplication(zigpy.application.ControllerApplication):
6464
{zigpy.config.CONF_DEVICE_BAUDRATE: 115200},
6565
]
6666

67+
_watchdog_period = 600 * 0.75
68+
6769
def __init__(self, config: dict[str, Any]):
6870
"""Initialize instance."""
6971

@@ -78,15 +80,15 @@ def __init__(self, config: dict[str, Any]):
7880
self._written_endpoints = set()
7981

8082
async def _watchdog_feed(self):
81-
await self._api.get_device_state()
82-
8383
if self._api.protocol_version >= PROTO_VER_WATCHDOG and not (
8484
self._api.firmware_version.platform == FirmwarePlatform.Conbee_III
8585
and self._api.firmware_version <= 0x26450900
8686
):
8787
await self._api.write_parameter(
88-
NetworkParameter.watchdog_ttl, int(2 * self._watchdog_period)
88+
NetworkParameter.watchdog_ttl, int(self._watchdog_period / 0.75)
8989
)
90+
else:
91+
await self._api.get_device_state()
9092

9193
async def connect(self):
9294
api = Deconz(self, self._config[zigpy.config.CONF_DEVICE])

0 commit comments

Comments
 (0)