Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Drop chip-device-ctrl #33488

Merged
merged 10 commits into from
May 24, 2024
Next Next commit
Drop chip-device-ctrl and ZCL* APIs
Drop the deprecated chip-device-ctrl and remove the ZCL* API from the
Python CHIP controller.
agners committed May 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8204ea9220bbc5b97b23fe7a88a47f29c6e8b5c6
5 changes: 1 addition & 4 deletions src/controller/python/BUILD.gn
Original file line number Diff line number Diff line change
@@ -414,10 +414,7 @@ chip_python_wheel_action("chip-clusters") {
}

chip_python_wheel_action("chip-repl") {
py_scripts = [
"chip-device-ctrl.py",
"chip-repl.py",
]
py_scripts = [ "chip-repl.py" ]

py_manifest_files = [
{
1,202 changes: 0 additions & 1,202 deletions src/controller/python/chip-device-ctrl.py

This file was deleted.

77 changes: 0 additions & 77 deletions src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
@@ -1480,83 +1480,6 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[
else:
return res.events

def ZCLSend(self, cluster, command, nodeid, endpoint, groupid, args, blocking=False):
''' Wrapper over SendCommand that catches the exceptions
Returns a tuple of (errorCode, CommandResponse)
'''
self.CheckIsActive()

req = None
try:
req = eval(
f"GeneratedObjects.{cluster}.Commands.{command}")(**args)
except BaseException:
raise UnknownCommand(cluster, command)
try:
res = asyncio.run(self.SendCommand(nodeid, endpoint, req))
logging.debug(f"CommandResponse {res}")
return (0, res)
except InteractionModelError as ex:
return (int(ex.status), None)

def ZCLReadAttribute(self, cluster, attribute, nodeid, endpoint, groupid, blocking=True):
''' Wrapper over ReadAttribute for a single attribute
Returns an AttributeReadResult
'''
self.CheckIsActive()

clusterType = getattr(GeneratedObjects, cluster)

try:
attributeType = eval(
f"GeneratedObjects.{cluster}.Attributes.{attribute}")
except BaseException:
raise UnknownAttribute(cluster, attribute)

result = asyncio.run(self.ReadAttribute(
nodeid, [(endpoint, attributeType)]))
path = ClusterAttribute.AttributePath.from_attribute(
EndpointId=endpoint, Attribute=attributeType)
return im.AttributeReadResult(path=im.AttributePath(nodeId=nodeid, endpointId=path.EndpointId, clusterId=path.ClusterId, attributeId=path.AttributeId),
status=0, value=result[endpoint][clusterType][attributeType], dataVersion=result[endpoint][clusterType][ClusterAttribute.DataVersion])

def ZCLWriteAttribute(self, cluster: str, attribute: str, nodeid, endpoint, groupid, value, dataVersion=0, blocking=True):
''' Wrapper over WriteAttribute for a single attribute
return PyChipError
'''
req = None
try:
req = eval(
f"GeneratedObjects.{cluster}.Attributes.{attribute}")(value)
except BaseException:
raise UnknownAttribute(cluster, attribute)

return asyncio.run(self.WriteAttribute(nodeid, [(endpoint, req, dataVersion)]))

def ZCLSubscribeAttribute(self, cluster, attribute, nodeid, endpoint, minInterval, maxInterval, blocking=True,
keepSubscriptions=False, autoResubscribe=True):
''' Wrapper over ReadAttribute for a single attribute
Returns a SubscriptionTransaction. See ReadAttribute for more information.
'''
self.CheckIsActive()

req = None
try:
req = eval(f"GeneratedObjects.{cluster}.Attributes.{attribute}")
except BaseException:
raise UnknownAttribute(cluster, attribute)
return asyncio.run(self.ReadAttribute(nodeid, [(endpoint, req)], None, False, reportInterval=(minInterval, maxInterval),
keepSubscriptions=keepSubscriptions, autoResubscribe=autoResubscribe))

def ZCLCommandList(self):
self.CheckIsActive()
return self._Cluster.ListClusterCommands()

def ZCLAttributeList(self):
self.CheckIsActive()

return self._Cluster.ListClusterAttributes()

def SetBlockingCB(self, blockingCB):
self.CheckIsActive()

1 change: 0 additions & 1 deletion src/pybindings/pycontroller/build-chip-wheel.py
Original file line number Diff line number Diff line change
@@ -60,7 +60,6 @@ def __init__(self, name):
chipPackageVer = args.build_number

installScripts = [
# InstalledScriptInfo('chip-device-ctrl.py'),
# InstalledScriptInfo('chip-repl.py'),
]