Skip to content

Commit

Permalink
Add coordinator device with correct status (#85)
Browse files Browse the repository at this point in the history
Update last_seen for coordinator when we receive any incoming message.
  • Loading branch information
Adminiuga authored Mar 9, 2020
1 parent a8d4f1d commit e9285b5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions zigpy_xbee/zigbee/application.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import asyncio
import binascii
import logging
import time

import zigpy.application
import zigpy.exceptions
import zigpy.device
import zigpy.exceptions
import zigpy.quirks
import zigpy.types
import zigpy.util
from zigpy.zcl.clusters.general import Groups
from zigpy.zdo.types import NodeDescriptor, ZDOCmd

from zigpy_xbee.types import EUI64, TXStatus, UNKNOWN_IEEE, UNKNOWN_NWK

from zigpy_xbee.types import EUI64, UNKNOWN_IEEE, UNKNOWN_NWK, TXStatus

# how long coordinator would hold message for an end device in 10ms units
CONF_CYCLIC_SLEEP_PERIOD = 0x0300
Expand Down Expand Up @@ -97,6 +97,7 @@ async def startup(self, auto_form=False):
LOGGER.debug("sending CE command: %s", exc)

dev = zigpy.device.Device(self, self.ieee, self.nwk)
dev.status = zigpy.device.Status.ENDPOINTS_INIT
dev.add_endpoint(XBEE_ENDPOINT_ID)
self.listener_event("raw_device_initialized", dev)
xbee_dev = XBeeCoordinator(self, self.ieee, self.nwk, dev)
Expand Down Expand Up @@ -283,6 +284,10 @@ def handle_rx(
)
self.handle_join(nwk, ieee, 0)

try:
self.devices[self.ieee].last_seen = time.time()
except KeyError:
pass
try:
device = self.get_device(nwk=src_nwk)
except KeyError:
Expand Down

0 comments on commit e9285b5

Please sign in to comment.