Skip to content

Commit

Permalink
Fix ZGP profile handling
Browse files Browse the repository at this point in the history
  • Loading branch information
konistehrad committed Dec 11, 2023
1 parent 8903a9d commit f613f67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zigpy_znp/commands/zgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ZGP(t.CommandsBase, subsystem=t.Subsystem.ZGP):
# This message provides a mechanism for dGP stub to request security data from the
# Green Power EndPoint in the host processor
SecReq = t.CommandDef(
t.CommandType.AREQ,
t.CommandType.SREQ,
0x03,
req_schema=(
t.Param(
Expand Down Expand Up @@ -127,14 +127,15 @@ class ZGP(t.CommandsBase, subsystem=t.Subsystem.ZGP):
"Handle", t.uint8_t, "dGP stub handle to match req to confirmation"
),
),
rsp_schema=t.STATUS_SCHEMA,
)

# This message provides a mechanism for identifying and conveying a received
# GPDF to the Green Power EndPoint in the host processor
DataInd = t.CommandDef(
t.CommandType.AREQ,
0x04,
req_schema=(
rsp_schema=(
t.Param("Status", t.uint8_t, "The status code as returned by the dGP stub"),
t.Param(
"RSSI",
Expand Down
11 changes: 11 additions & 0 deletions zigpy_znp/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ def _bind_callbacks(self) -> None:
self.on_intentionally_unhandled_message,
)

self._znp.callback_for_response(
c.ZGP.DataInd.Callback(partial=True),
self.on_zgp_data_ind
)

def on_zgp_data_ind(self, msg: c.ZGP.DataInd.Callback) -> None:
pass

def on_intentionally_unhandled_message(self, msg: t.CommandBase) -> None:
"""
Some commands are unhandled but frequently sent by devices on the network. To
Expand Down Expand Up @@ -691,6 +699,9 @@ def _find_endpoint(self, dst_ep: int, profile: int, cluster: int) -> int:

if dst_ep == ZDO_ENDPOINT:
return ZDO_ENDPOINT

if profile == zigpy.profiles.zgp.PROFILE_ID:
return zigpy.profiles.zgp.GREENPOWER_ENDPOINT_ID

# Newer Z-Stack releases ignore profiles and will work properly with endpoint 1
if (
Expand Down

0 comments on commit f613f67

Please sign in to comment.