Skip to content

Commit

Permalink
Reset watchdog (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
damarco authored Jan 15, 2019
1 parent 0e74079 commit 2e56a3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions zigpy_deconz/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
'permit_join': (0x21, t.uint8_t),
'protocol_version': (0x22, t.uint16_t),
'nwk_update_id': (0x24, t.uint8_t),
'watchdog_ttl': (0x26, t.uint32_t),
}

NETWORK_PARAMETER_BY_ID = {v[0]: (k, v[1]) for k, v in NETWORK_PARAMETER.items()}
Expand Down
7 changes: 7 additions & 0 deletions zigpy_deconz/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def __init__(self, api, database_file=None):
self._nwk = 0
self.discovering = False

asyncio.ensure_future(self._reset_watchdog())

async def _reset_watchdog(self):
while True:
await self._api.write_parameter(NETWORK_PARAMETER['watchdog_ttl'][0], 3600)
await asyncio.sleep(1200)

async def startup(self, auto_form=False):
"""Perform a complete application startup"""
await self._api.device_state()
Expand Down

0 comments on commit 2e56a3b

Please sign in to comment.