Skip to content

Commit 09bcd3e

Browse files
committed
refactor: remove unused commands.
1 parent 8cca972 commit 09bcd3e

File tree

2 files changed

+3
-39
lines changed

2 files changed

+3
-39
lines changed

matter_server/common/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ class APICommand(str, Enum):
5151
CHECK_NODE_UPDATE = "check_node_update"
5252
UPDATE_NODE = "update_node"
5353
SET_DEFAULT_FABRIC_LABEL = "set_default_fabric_label"
54-
GET_ACL_ENTRY = "get_acl_entry"
5554
SET_ACL_ENTRY = "set_acl_entry"
56-
GET_NODE_BINDINGS = "get_node_bindings"
5755
SET_NODE_BINDING = "set_node_binding"
5856

5957

matter_server/server/device_controller.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from chip.ChipDeviceCtrl import ChipDeviceController
2121
from chip.clusters import Attribute, Objects as Clusters
22-
from chip.clusters.Attribute import SubscriptionTransaction, ValueDecodeFailure
22+
from chip.clusters.Attribute import AttributeWriteResult, ValueDecodeFailure
2323
from chip.clusters.ClusterObjects import ALL_ATTRIBUTES, ALL_CLUSTERS, Cluster
2424
from chip.discovery import DiscoveryType
2525
from chip.exceptions import ChipStackError
@@ -862,53 +862,19 @@ async def set_acl_entry(
862862
self,
863863
node_id: int,
864864
entry: list[Clusters.AccessControl.Structs.AccessControlEntryStruct],
865-
):
865+
) -> list[AttributeWriteResult] | None:
866866
"""Set acl entry"""
867867
return await self._chip_device_controller.write_attribute(
868868
node_id, [(0, Clusters.AccessControl.Attributes.Acl(entry))]
869869
)
870870

871-
@api_command(APICommand.GET_ACL_ENTRY)
872-
async def get_acl_entry(self, node_id: int):
873-
"""Get acl entry"""
874-
read_response: (
875-
SubscriptionTransaction | Attribute.AsyncReadTransaction.ReadResponse | None
876-
) = await self._chip_device_controller.read_attribute(
877-
node_id, [(0, Clusters.AccessControl.Attributes.Acl)]
878-
)
879-
acl_entities = []
880-
if isinstance(read_response, Attribute.AsyncReadTransaction.ReadResponse):
881-
acl_entities: list[
882-
Clusters.AccessControl.Structs.AccessControlEntryStruct
883-
] = read_response.attributes[0][Clusters.AccessControl][
884-
Clusters.AccessControl.Attributes.Acl
885-
]
886-
return acl_entities
887-
888-
@api_command(APICommand.GET_NODE_BINDINGS)
889-
async def get_node_bindings(self, node_id: int):
890-
"""Get node bindings"""
891-
read_response: (
892-
SubscriptionTransaction | Attribute.AsyncReadTransaction.ReadResponse | None
893-
) = await self._chip_device_controller.read_attribute(
894-
node_id, (Clusters.Binding.Attributes.Binding,)
895-
)
896-
897-
bindings = []
898-
if isinstance(read_response, Attribute.AsyncReadTransaction.ReadResponse):
899-
for k, v in read_response.attributes.items():
900-
bindings.append(
901-
{k: v[Clusters.Binding][Clusters.Binding.Attributes.Binding]}
902-
)
903-
return bindings
904-
905871
@api_command(APICommand.SET_NODE_BINDING)
906872
async def set_node_binding(
907873
self,
908874
node_id: int,
909875
endpoint: int,
910876
bindings: list[Clusters.Binding.Structs.TargetStruct],
911-
):
877+
) -> list[AttributeWriteResult] | None:
912878
"""Set node binding"""
913879
return await self._chip_device_controller.write_attribute(
914880
node_id, [(endpoint, Clusters.Binding.Attributes.Binding(bindings))]

0 commit comments

Comments
 (0)