Skip to content

Commit 6e09580

Browse files
authored
0.3.0 Release
0.3.0 Release
2 parents c01bab0 + 45d2020 commit 6e09580

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

zigpy_xbee/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MAJOR_VERSION = 0
2-
MINOR_VERSION = 2
3-
PATCH_VERSION = '1'
2+
MINOR_VERSION = 3
3+
PATCH_VERSION = '0'
44
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
55
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)

zigpy_xbee/zigbee/application.py

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
import zigpy.application
66
import zigpy.exceptions
7+
import zigpy.device
8+
import zigpy.quirks
79
import zigpy.types
810
import zigpy.util
9-
from zigpy.zdo.types import LogicalType
11+
from zigpy.zcl.clusters.general import Groups
12+
from zigpy.zdo.types import LogicalType, NodeDescriptor
1013

1114
from zigpy_xbee.types import UNKNOWN_IEEE
1215

@@ -19,9 +22,10 @@
1922
TIMEOUT_REPLY = 5
2023
TIMEOUT_REPLY_EXTENDED = 28
2124

22-
2325
LOGGER = logging.getLogger(__name__)
2426

27+
XBEE_ENDPOINT_ID = 0xe6
28+
2529

2630
class ControllerApplication(zigpy.application.ControllerApplication):
2731
def __init__(self, api, database_file=None):
@@ -80,7 +84,12 @@ async def startup(self, auto_form=False):
8084
LOGGER.debug("Coordinator %s", 'enabled' if ce else 'disabled')
8185
except RuntimeError as exc:
8286
LOGGER.debug("sending CE command: %s", exc)
83-
self.add_device(self.ieee, self.nwk)
87+
88+
dev = zigpy.device.Device(self, self.ieee, self.nwk)
89+
dev.add_endpoint(XBEE_ENDPOINT_ID)
90+
self.listener_event('raw_device_initialized', dev)
91+
xbee_dev = XBeeCoordinator(self, self.ieee, self.nwk, dev)
92+
self.devices[dev.ieee] = xbee_dev
8493

8594
async def force_remove(self, dev):
8695
"""Forcibly remove device from NCP."""
@@ -196,7 +205,7 @@ def handle_rx(self, src_ieee, src_nwk, src_ep, dst_ep, cluster_id, profile_id, r
196205
if src_nwk == 0:
197206
# I'm not sure why we've started seeing ZDO requests from ourself.
198207
# Ignore for now.
199-
return
208+
LOGGER.info("handle_rx self addressed")
200209

201210
ember_ieee = zigpy.types.EUI64(src_ieee)
202211
if dst_ep == 0 and cluster_id == 0x13:
@@ -282,3 +291,35 @@ async def broadcast(self, profile, cluster, src_ep, dst_ep, grpid, radius,
282291
data,
283292
)
284293
return await asyncio.wait_for(request, timeout=TIMEOUT_TX_STATUS)
294+
295+
296+
class XBeeCoordinator(zigpy.quirks.CustomDevice):
297+
class XBeeGroup(zigpy.quirks.CustomCluster, Groups):
298+
cluster_id = 0x0006
299+
300+
class XBeeGroupResponse(zigpy.quirks.CustomCluster, Groups):
301+
import zigpy.zcl.foundation as f
302+
303+
cluster_id = 0x8006
304+
ep_attribute = 'xbee_groups_response'
305+
306+
client_commands = {**Groups.client_commands}
307+
client_commands[0x0004] = ('remove_all_response', (f.Status, ), True)
308+
309+
def __init__(self, *args, **kwargs):
310+
super().__init__(*args, **kwargs)
311+
self.node_desc = NodeDescriptor(0x01, 0x40, 0x8e, 0x101e, 0x52,
312+
0x00ff, 0x2c00, 0x00ff, 0x00)
313+
314+
replacement = {
315+
'endpoints': {
316+
XBEE_ENDPOINT_ID: {
317+
'device_type': 0x0050,
318+
'manufacturer': 'Digi',
319+
'model': 'XBee',
320+
'profile_id': 0xc105,
321+
'input_clusters': [XBeeGroup, XBeeGroupResponse],
322+
'output_clusters': [],
323+
}
324+
}
325+
}

0 commit comments

Comments
 (0)