From 71dddab1101e5e8b42ec6acaf405f9a1ec81efee Mon Sep 17 00:00:00 2001 From: Jerry Johns Date: Tue, 8 Feb 2022 21:10:22 -0800 Subject: [PATCH] Deleted Python Notebook files at the root level --- Matter - Multi Fabric Commissioning.ipynb | 823 --------------- Matter - REPL Basics.ipynb | 1139 --------------------- 2 files changed, 1962 deletions(-) delete mode 100644 Matter - Multi Fabric Commissioning.ipynb delete mode 100644 Matter - REPL Basics.ipynb diff --git a/Matter - Multi Fabric Commissioning.ipynb b/Matter - Multi Fabric Commissioning.ipynb deleted file mode 100644 index c7f92aa331d5f6..00000000000000 --- a/Matter - Multi Fabric Commissioning.ipynb +++ /dev/null @@ -1,823 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e8b2f5eb", - "metadata": {}, - "source": [ - "# Multi Fabric Commissioning\n", - "\n", - "_This notebook walks through a flow that sets up two separate commissioners on two different fabrics and commissions a target device onto those fabrics._" - ] - }, - { - "cell_type": "markdown", - "id": "99ce2877", - "metadata": {}, - "source": [ - "### Imports\n", - "\n", - "Let's first begin by setting up by importing some key modules that are needed to make it easier for us to interact with the Matter stack." - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "id": "52b40db6", - "metadata": {}, - "outputs": [], - "source": [ - "from rich import print\n", - "from rich.pretty import pprint\n", - "from rich import inspect\n", - "import logging\n", - "import chip\n", - "import chip.logging\n", - "from chip import ChipDeviceCtrl\n", - "import chip.clusters as Clusters\n", - "from chip.ChipReplStartup import *\n", - "from chip.ChipStack import *\n", - "import subprocess, sys" - ] - }, - { - "cell_type": "markdown", - "id": "78e14359", - "metadata": {}, - "source": [ - "### Initialization\n", - "\n", - "Next, let's initialize the REPL environment and the Matter Stack." - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "id": "e3057f9d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
──────────────────────────────────────── Matter REPL ────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m──────────────────────────────────────── \u001b[0mMatter REPL\u001b[92m ────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n",
-       "            \n",
-       "    \n",
-       "            Welcome to the Matter Python REPL!\n",
-       "    \n",
-       "            For help, please type matterhelp()\n",
-       "    \n",
-       "            To get more information on a particular object/class, you can pass\n",
-       "            that into matterhelp() as well.\n",
-       "    \n",
-       "            \n",
-       "
\n" - ], - "text/plain": [ - "\n", - " \n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m Welcome to the Matter Python REPL!\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m For help, please type \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m To get more information on a particular object/class, you can pass\u001b[0m\n", - "\u001b[1;34m that into \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\u001b[1;34m as well.\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m \u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
─────────────────────────────────────────────────────────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m─────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "ReplInit()\n", - "chipStack = ChipStack()" - ] - }, - { - "cell_type": "markdown", - "id": "9cb06305", - "metadata": {}, - "source": [ - "### Launch Server\n", - "\n", - "Let's launch an instance of the `chip-all-clusters-app`." - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "id": "52ccd8c6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
<subprocess.Popen object at 0x10d12db50>\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m<\u001b[0m\u001b[1;95msubprocess.Popen\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x10d12db50\u001b[0m\u001b[1m>\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "subprocess.Popen(['killall', 'chip-all-clusters-app'])" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "id": "1a8022e6", - "metadata": {}, - "outputs": [], - "source": [ - "process = subprocess.Popen('./out/debug/chip-all-clusters-app', stdout=subprocess.DEVNULL)" - ] - }, - { - "cell_type": "markdown", - "id": "c22ea8ee", - "metadata": {}, - "source": [ - "### Create Controller on Fabric A" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "id": "5e964fe3", - "metadata": {}, - "outputs": [], - "source": [ - "devCtrl = ChipDeviceCtrl.ChipDeviceController(controllerNodeId=1)" - ] - }, - { - "cell_type": "markdown", - "id": "b33dec2e", - "metadata": {}, - "source": [ - "### Commission Target" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "id": "e98d8157", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2021-12-29 15:02:03 johnsj-macbookpro1.roam.corp.google.com chip.CTL[86631] ERROR Unable to find country code, defaulting to WW\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Established CASE with Device\n" - ] - }, - { - "data": { - "text/html": [ - "
True\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[3;92mTrue\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Node address has been updated\n", - "Commissioning complete\n" - ] - } - ], - "source": [ - "devCtrl.CommissionIP(b'127.0.0.1', 20202021, 1)" - ] - }, - { - "cell_type": "markdown", - "id": "820fcede", - "metadata": {}, - "source": [ - "### Read out the Fabric List to validate" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "id": "6802862a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "0: {\n",
-       "│   │   <class 'chip.clusters.Objects.OperationalCredentials'>: {\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'>: [\n",
-       "│   │   │   │   FabricDescriptor(\n",
-       "│   │   │   │   │   fabricIndex=1,\n",
-       "│   │   │   │   │   rootPublicKey=b'\\x040\\xa5d\\x8eX4]\\xa1\\xe18\\x04\\x9b\\xf2E\\x8eh\\x13dwQ\\xd9\\x19\\xa5\\xe4\\x88h\\xe5q\\xacPCtY\\xb9\\xcc\\x94KQ\\xa85\\xfa(\\x07\\x80q+\\xa6\\x9a%\\x8d\\x1f\\xf4MJ\\xa0\\x9e[\\xafW0\"\\x82\\xf4\\xbb',\n",
-       "│   │   │   │   │   vendorId=27424,\n",
-       "│   │   │   │   │   fabricId=3,\n",
-       "│   │   │   │   │   nodeId=1,\n",
-       "│   │   │   │   │   label=''\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.SupportedFabrics'>: 16,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'>: 1,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'>: [\n",
-       "│   │   │   │   b'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x03\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x03\\x18$\\x07\\x01$\\x08\\x010\\tA\\x040\\xa5d\\x8eX4]\\xa1\\xe18\\x04\\x9b\\xf2E\\x8eh\\x13dwQ\\xd9\\x19\\xa5\\xe4\\x88h\\xe5q\\xacPCtY\\xb9\\xcc\\x94KQ\\xa85\\xfa(\\x07\\x80q+\\xa6\\x9a%\\x8d\\x1f\\xf4MJ\\xa0\\x9e[\\xafW0\"\\x82\\xf4\\xbb7\\n5\\x01)\\x01\\x18$\\x02`0\\x04\\x14j\\xf4P\\xfa\\x1dE\\xff28AZ\\xc9\\x05]u=\\x07X\\x91\\\\0\\x05\\x14j\\xf4P\\xfa\\x1dE\\xff28AZ\\xc9\\x05]u=\\x07X\\x91\\\\\\x180\\x0b@\\xbc@\\xe6\\xa9\\xc1\\xecjP!\\xb1N\\xc6_\\xe1k\\xaf\\xc2\\xc1~\\xb5\\xa38\\xb3\\x19\\t\\xbd\\xbd\\x96\\xfcV\\xb6\\x07\\xfe\\xec\\xc8q\"\\x9b\\xadX\\xdfg\\xfb\\xbaW\\x90(\\xfe\\xeb\\x14oqeV\\x119\\x06\\xae)Q\\x0e+G\\x89\\x18'\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CurrentFabricIndex'>: 1,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'>: 1\n",
-       "│   │   }\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m0\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mFabricDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricIndex\u001b[0m=\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrootPublicKey\u001b[0m=\u001b[32mb\u001b[0m\u001b[32m'\\x040\\xa5d\\x8eX4\u001b[0m\u001b[32m]\u001b[0m\u001b[32m\\xa1\\xe18\\x04\\x9b\\xf2E\\x8eh\\x13dwQ\\xd9\\x19\\xa5\\xe4\\x88h\\xe5q\\xacPCtY\\xb9\\xcc\\x94KQ\\xa85\\xfa\u001b[0m\u001b[32m(\u001b[0m\u001b[32m\\x07\\x80q+\\xa6\\x9a%\\x8d\\x1f\\xf4MJ\\xa0\\x9e\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\xafW0\"\\x82\\xf4\\xbb'\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mvendorId\u001b[0m=\u001b[1;36m27424\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricId\u001b[0m=\u001b[1;36m3\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mnodeId\u001b[0m=\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mlabel\u001b[0m=\u001b[32m''\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.SupportedFabrics'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m16\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[32mb'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x03\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x03\\x18$\\x07\\x01$\\x08\\x010\\tA\\x040\\xa5d\\x8eX4\u001b[0m\u001b[32m]\u001b[0m\u001b[32m\\xa1\\xe18\\x04\\x9b\\xf2E\\x8eh\\x13dwQ\\xd9\\x19\\xa5\\xe4\\x88h\\xe5q\\xacPCtY\\xb9\\xcc\\x94KQ\\xa85\\xfa\u001b[0m\u001b[32m(\u001b[0m\u001b[32m\\x07\\x80q+\\xa6\\x9a%\\x8d\\x1f\\xf4MJ\\xa0\\x9e\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\xafW0\"\\x82\\xf4\\xbb7\\n5\\x01\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\x01\\x18$\\x02`0\\x04\\x14j\\xf4P\\xfa\\x1dE\\xff28AZ\\xc9\\x05\u001b[0m\u001b[32m]\u001b[0m\u001b[32mu\u001b[0m\u001b[32m=\\x07X\\x91\\\\0\\x05\\x14j\\xf4P\\xfa\\x1dE\\xff28AZ\\xc9\\x05\u001b[0m\u001b[32m]\u001b[0m\u001b[32mu\u001b[0m\u001b[32m=\\x07X\\x91\\\\\\x180\\x0b@\\xbc@\\xe6\\xa9\\xc1\\xecjP!\\xb1N\\xc6_\\xe1k\\xaf\\xc2\\xc1~\\xb5\\xa38\\xb3\\x19\\t\\xbd\\xbd\\x96\\xfcV\\xb6\\x07\\xfe\\xec\\xc8q\"\\x9b\\xadX\\xdfg\\xfb\\xbaW\\x90\u001b[0m\u001b[32m(\u001b[0m\u001b[32m\\xfe\\xeb\\x14oqeV\\x119\\x06\\xae\u001b[0m\u001b[32m)\u001b[0m\u001b[32mQ\\x0e+G\\x89\\x18'\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.CurrentFabricIndex'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.ReadAttribute(1, [(Clusters.OperationalCredentials)])" - ] - }, - { - "cell_type": "markdown", - "id": "dbade62b", - "metadata": {}, - "source": [ - "Note that the `FabricsList` contains just a single item with a `fabriIndex` of 1, and a `fabricId` of 1." - ] - }, - { - "cell_type": "markdown", - "id": "7326ae6a", - "metadata": {}, - "source": [ - "### Create Controller on Fabric B" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a975776b", - "metadata": {}, - "outputs": [], - "source": [ - "devCtrl2 = ChipDeviceCtrl.ChipDeviceController(controllerNodeId=30)" - ] - }, - { - "cell_type": "markdown", - "id": "72b857b3", - "metadata": {}, - "source": [ - "### Open Commissioning Window\n", - "\n", - "The target right now doesn't accept commissioning requests. So let's go ahead and open the commissioning window to permit the second controller on Fabric B to commission the target. This request has to originate from the 1st controller." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "f4fca3f4", - "metadata": {}, - "outputs": [], - "source": [ - "await devCtrl.SendCommand(1, 0, Clusters.AdministratorCommissioning.Commands.OpenBasicCommissioningWindow(100))" - ] - }, - { - "cell_type": "markdown", - "id": "b7b2215e", - "metadata": {}, - "source": [ - "### Commission Target on Fabric B" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "41255a44", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2021-12-28 23:33:17 johnsj-macbookpro1.roam.corp.google.com chip.CTL[86631] ERROR Unable to find country code, defaulting to WW\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Established CASE with Device\n" - ] - }, - { - "data": { - "text/html": [ - "
True\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[3;92mTrue\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Node address has been updated\n", - "Commissioning complete\n" - ] - } - ], - "source": [ - "devCtrl2.CommissionIP(b'127.0.0.1', 20202021, 1)" - ] - }, - { - "cell_type": "markdown", - "id": "b17289ff", - "metadata": {}, - "source": [ - "### Read out the Fabric List to validate" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "903cb0fd", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "0: {\n",
-       "│   │   <class 'chip.clusters.Objects.AccessControl'>: {\n",
-       "│   │   │   <class 'chip.clusters.Objects.AccessControl.Attributes.Acl'>: [],\n",
-       "│   │   │   <class 'chip.clusters.Objects.AccessControl.Attributes.Extension'>: [],\n",
-       "│   │   │   <class 'chip.clusters.Objects.AccessControl.Attributes.ClusterRevision'>: 1\n",
-       "│   │   }\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m0\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.AccessControl'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.AccessControl.Attributes.Acl'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.AccessControl.Attributes.Extension'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.AccessControl.Attributes.ClusterRevision'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl2.ReadAttribute(1, [(Clusters.AccessControl)])" - ] - }, - { - "cell_type": "markdown", - "id": "ebf71c37", - "metadata": {}, - "source": [ - "Note that the FabricsList contains two items now!" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "id": "cf9e453e", - "metadata": {}, - "outputs": [ - { - "ename": "ChipStackError", - "evalue": "Chip Stack Error 11", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mChipStackError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/nq/rnhbb96s3sl9n9lrzgx40tfw008537/T/ipykernel_12727/1832887926.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mawait\u001b[0m \u001b[0mdevCtrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReadAttribute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mClusters\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mLevelControl\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/work/devel/ext-git/connectedhomeip-2/out/python_env/lib/python3.8/site-packages/chip/ChipDeviceCtrl.py\u001b[0m in \u001b[0;36mReadAttribute\u001b[0;34m(self, nodeid, attributes, returnClusterObject, reportInterval)\u001b[0m\n\u001b[1;32m 524\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 525\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ChipStack\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mErrorToException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 526\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;32mawait\u001b[0m \u001b[0mfuture\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 527\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 528\u001b[0m async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[\n", - "\u001b[0;31mChipStackError\u001b[0m: Chip Stack Error 11" - ] - } - ], - "source": [ - "s = await devCtrl.ReadAttribute(1, [(Clusters.LevelControl)], True, (0, 4))" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "id": "713c1139-e0a2-469e-a471-593955a1b354", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
<Subscription (Id=13932082784090111118)>\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m<\u001b[0m\u001b[1;95mSubscription\u001b[0m\u001b[39m \u001b[0m\u001b[1;39m(\u001b[0m\u001b[33mId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m13932082784090111118\u001b[0m\u001b[1;39m)\u001b[0m\u001b[1m>\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "s" - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "id": "a92d3e5d-ff49-455e-8e8e-fd96ef258eb3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "1: {\n",
-       "│   │   <class 'chip.clusters.Objects.LevelControl'>: LevelControl(\n",
-       "│   │   │   currentLevel=0,\n",
-       "│   │   │   remainingTime=0,\n",
-       "│   │   │   minLevel=0,\n",
-       "│   │   │   maxLevel=255,\n",
-       "│   │   │   currentFrequency=0,\n",
-       "│   │   │   minFrequency=0,\n",
-       "│   │   │   maxFrequency=0,\n",
-       "│   │   │   options=0,\n",
-       "│   │   │   onOffTransitionTime=0,\n",
-       "│   │   │   onLevel=254,\n",
-       "│   │   │   onTransitionTime=0,\n",
-       "│   │   │   offTransitionTime=0,\n",
-       "│   │   │   defaultMoveRate=0,\n",
-       "│   │   │   startUpCurrentLevel=0,\n",
-       "│   │   │   attributeList=None,\n",
-       "│   │   │   featureMap=None,\n",
-       "│   │   │   clusterRevision=3\n",
-       "│   │   )\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m1\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.LevelControl'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;35mLevelControl\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mcurrentLevel\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mremainingTime\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mminLevel\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mmaxLevel\u001b[0m=\u001b[1;36m255\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mcurrentFrequency\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mminFrequency\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mmaxFrequency\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33moptions\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33monOffTransitionTime\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33monLevel\u001b[0m=\u001b[1;36m254\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33monTransitionTime\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33moffTransitionTime\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mdefaultMoveRate\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mstartUpCurrentLevel\u001b[0m=\u001b[1;36m0\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mattributeList\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mfeatureMap\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclusterRevision\u001b[0m=\u001b[1;36m3\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "s.GetAttributes()" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "id": "88032327-5acd-4d2f-892b-72dc41959ec0", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.OnOff.Attributes.OnTime'>,\n",
-       "'Value': 0\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OnOff.Attributes.OnTime'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[1;36m0\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.OnOff.Attributes.OnOff'>,\n",
-       "'Value': False\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OnOff.Attributes.OnOff'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[3;91mFalse\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.OnOff.Attributes.OnTime'>,\n",
-       "'Value': 0\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OnOff.Attributes.OnTime'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[1;36m0\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.OnOff.Attributes.OnOff'>,\n",
-       "'Value': False\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OnOff.Attributes.OnOff'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[3;91mFalse\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.SendCommand(1, 1, Clusters.OnOff.Commands.Off())" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "id": "87046a41-08ff-4de2-9a9b-400922280bd6", - "metadata": {}, - "outputs": [], - "source": [ - "await devCtrl.SendCommand(1, 1, Clusters.OnOff.Commands.On())" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "id": "7957fc03-e91a-4a07-8b08-cc1e86e595c3", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'>,\n",
-       "'Value': 1\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[1;36m1\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attribute Changed:\n" - ] - }, - { - "data": { - "text/html": [ - "
{\n",
-       "'Endpoint': 1,\n",
-       "'Attribute': <class 'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'>,\n",
-       "'Value': 100\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Endpoint'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Attribute'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'\u001b[0m\u001b[1m>\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[32m'Value'\u001b[0m: \u001b[1;36m100\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.SendCommand(1, 1, Clusters.LevelControl.Commands.MoveToLevel(100, 10, 0, 0))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cefa5cae-67f4-49a9-a4c1-285f315c51e2", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "matter-env", - "language": "python", - "name": "matter-env" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.2+chromium.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/Matter - REPL Basics.ipynb b/Matter - REPL Basics.ipynb deleted file mode 100644 index 1928f888710ea3..00000000000000 --- a/Matter - REPL Basics.ipynb +++ /dev/null @@ -1,1139 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "e8b2f5eb", - "metadata": {}, - "source": [ - "# Interaction Model Examples\n", - "\n", - "This notebook walks through the various interactions that can be initiated from the REPL towards a target using the Matter Interaction Model (IM) and Data Model (DM)." - ] - }, - { - "cell_type": "markdown", - "id": "99ce2877", - "metadata": {}, - "source": [ - "## Imports\n", - "\n", - "Let's first begin by setting up by importing some key modules that are needed to make it easier for us to interact with the Matter stack." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "52b40db6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
──────────────────────────────────────── Matter REPL ────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m──────────────────────────────────────── \u001b[0mMatter REPL\u001b[92m ────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n",
-       "            \n",
-       "    \n",
-       "            Welcome to the Matter Python REPL!\n",
-       "    \n",
-       "            For help, please type matterhelp()\n",
-       "    \n",
-       "            To get more information on a particular object/class, you can pass\n",
-       "            that into matterhelp() as well.\n",
-       "    \n",
-       "            \n",
-       "
\n" - ], - "text/plain": [ - "\n", - " \n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m Welcome to the Matter Python REPL!\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m For help, please type \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m To get more information on a particular object/class, you can pass\u001b[0m\n", - "\u001b[1;34m that into \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\u001b[1;34m as well.\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m \u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
─────────────────────────────────────────────────────────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m─────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-01-18 14:07:57 johnsj-macbookpro1.roam.corp.google.com root[52410] CRITICAL Loading configuration from /tmp/repl-storage.json...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loading CHIP DLL...\n" - ] - }, - { - "data": { - "text/html": [ - "
\n",
-       "\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
Restoring FabricAdmin from storage to manage FabricId 1, FabricIndex 1...\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[38;5;129mRestoring FabricAdmin from storage to manage FabricId \u001b[0m\u001b[1;38;5;129m1\u001b[0m\u001b[38;5;129m, FabricIndex \u001b[0m\u001b[1;38;5;129m1\u001b[0m\u001b[38;5;129m...\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "New FabricAdmin: FabricId: 1(1)\n" - ] - }, - { - "data": { - "text/html": [ - "
\n",
-       "Fabric Admins have been loaded and are available at fabricAdmins\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[34mFabric Admins have been loaded and are available at \u001b[0m\u001b[31mfabricAdmins\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n",
-       "\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
Creating default device controller on fabric 1...\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[38;5;129mCreating default device controller on fabric \u001b[0m\u001b[1;38;5;129m1\u001b[0m\u001b[38;5;129m...\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Allocating new controller with FabricId: 1(1), NodeId: 1\n" - ] - }, - { - "data": { - "text/html": [ - "
\n",
-       "\n",
-       "Default CHIP Device Controller has been initialized to manage fabricAdmins[0], and is \n",
-       "available as devCtrl\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\n", - "\u001b[34mDefault CHIP Device Controller has been initialized to manage \u001b[0m\u001b[1;31mfabricAdmins\u001b[0m\u001b[1;31m[\u001b[0m\u001b[1;31m0\u001b[0m\u001b[1;31m]\u001b[0m\u001b[1;34m, and is \u001b[0m\n", - "\u001b[1;34mavailable as \u001b[0m\u001b[1;31mdevCtrl\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from rich import print\n", - "from rich.pretty import pprint\n", - "from rich import inspect\n", - "import logging\n", - "import chip\n", - "import chip.logging\n", - "from chip import ChipDeviceCtrl\n", - "import chip.clusters as Clusters\n", - "from chip.ChipReplStartup import *\n", - "from chip.ChipStack import *\n", - "import subprocess, sys" - ] - }, - { - "cell_type": "markdown", - "id": "78e14359", - "metadata": {}, - "source": [ - "## Initialization\n", - "\n", - "Next, let's initialize the REPL environment and the Matter Stack." - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "e3057f9d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
──────────────────────────────────────── Matter REPL ────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m──────────────────────────────────────── \u001b[0mMatter REPL\u001b[92m ────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n",
-       "            \n",
-       "    \n",
-       "            Welcome to the Matter Python REPL!\n",
-       "    \n",
-       "            For help, please type matterhelp()\n",
-       "    \n",
-       "            To get more information on a particular object/class, you can pass\n",
-       "            that into matterhelp() as well.\n",
-       "    \n",
-       "            \n",
-       "
\n" - ], - "text/plain": [ - "\n", - " \n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m Welcome to the Matter Python REPL!\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m For help, please type \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m To get more information on a particular object/class, you can pass\u001b[0m\n", - "\u001b[1;34m that into \u001b[0m\u001b[1;32mmatterhelp\u001b[0m\u001b[1;32m(\u001b[0m\u001b[1;32m)\u001b[0m\u001b[1;34m as well.\u001b[0m\n", - "\u001b[1;34m \u001b[0m\n", - "\u001b[1;34m \u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
─────────────────────────────────────────────────────────────────────────────────────────────\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[92m─────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "ReplInit()\n", - "chipStack = ChipStack()\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "9cb06305", - "metadata": {}, - "source": [ - "## Launch Server\n", - "\n", - "Let's launch an instance of the `chip-all-clusters-app`." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "52ccd8c6", - "metadata": {}, - "outputs": [], - "source": [ - "subprocess.Popen(['pkill', '-f', 'chip-all-clusters-app'])\n", - "process = subprocess.Popen('./out/debug/chip-all-clusters-app', stdout=subprocess.DEVNULL)" - ] - }, - { - "cell_type": "markdown", - "id": "b33dec2e", - "metadata": {}, - "source": [ - "### Commission Target\n", - "\n", - "Commission the target with a NodeId of 1." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "5e964fe3", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2022-01-02 21:25:51 johnsj-macbookpro1.roam.corp.google.com chip.CTL[93727] ERROR Unable to find country code, defaulting to WW\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Established CASE with Device\n", - "Node address has been updated\n", - "Commissioning complete\n" - ] - }, - { - "data": { - "text/html": [ - "
True\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[3;92mTrue\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "devCtrl = ChipDeviceCtrl.ChipDeviceController(controllerNodeId=1)\n", - "devCtrl.CommissionIP(b'127.0.0.1', 20202021, 1)" - ] - }, - { - "cell_type": "markdown", - "id": "c22ea8ee", - "metadata": { - "tags": [] - }, - "source": [ - "## Invoke Commands" - ] - }, - { - "cell_type": "markdown", - "id": "4c94d599-e243-43de-8abe-bb4d9b1f52d4", - "metadata": {}, - "source": [ - "### Basic Command (Success Response)" - ] - }, - { - "cell_type": "markdown", - "id": "52e6e92e-0bc6-45f2-9b6b-74d43ba3048c", - "metadata": {}, - "source": [ - "Let's send a basic command to turn on/off the light on Endpoint 1." - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "bed38512-91f8-4d4e-b6e1-b30749137bbd", - "metadata": {}, - "outputs": [], - "source": [ - "await devCtrl.SendCommand(1, 1, Clusters.OnOff.Commands.On())" - ] - }, - { - "cell_type": "markdown", - "id": "b1c0fe3c-95da-4980-9b9b-2a5ab602af44", - "metadata": {}, - "source": [ - "The receipt of a successful status response will result in the command just returning successfully. Otherwise, an exception will be thrown." - ] - }, - { - "cell_type": "markdown", - "id": "80c604b9-f6dc-4ec5-91e8-a6e806c821a6", - "metadata": {}, - "source": [ - "### Basic Command (Failure Response)" - ] - }, - { - "cell_type": "markdown", - "id": "753f5a54-4a75-41ed-a7c0-99c8cca8b6de", - "metadata": { - "tags": [] - }, - "source": [ - "If we send the same command to an invalid endpoint, an exception is thrown:" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "2935f13b-ca16-4f9c-b320-8896c8465278", - "metadata": {}, - "outputs": [ - { - "ename": "InteractionModelError", - "evalue": "InteractionModelError: Failure (0x1)", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mInteractionModelError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/nq/rnhbb96s3sl9n9lrzgx40tfw008537/T/ipykernel_93727/18655580.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mawait\u001b[0m \u001b[0mdevCtrl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSendCommand\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m100\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mClusters\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOnOff\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCommands\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/work/devel/ext-git/connectedhomeip-2/out/python_env/lib/python3.8/site-packages/chip/ChipDeviceCtrl.py\u001b[0m in \u001b[0;36mSendCommand\u001b[0;34m(self, nodeid, endpoint, payload, responseType)\u001b[0m\n\u001b[1;32m 420\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 421\u001b[0m \u001b[0mfuture\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_exception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ChipStack\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mErrorToException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 422\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;32mawait\u001b[0m \u001b[0mfuture\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 423\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 424\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mWriteAttribute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnodeid\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattributes\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mtyping\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mtyping\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTuple\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mClusterObjects\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mClusterAttributeDescriptor\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mInteractionModelError\u001b[0m: InteractionModelError: Failure (0x1)" - ] - } - ], - "source": [ - "await devCtrl.SendCommand(1, 100, Clusters.OnOff.Commands.On())" - ] - }, - { - "cell_type": "markdown", - "id": "5296f2bc-5e9d-4b06-a7c1-f247ebe5eac2", - "metadata": {}, - "source": [ - "### Basic Command (Data Response)" - ] - }, - { - "cell_type": "markdown", - "id": "bb196da4-5162-4c4b-ae64-ef1d23a04eb9", - "metadata": { - "tags": [] - }, - "source": [ - "Here's an example of a command that sends back a data response, and how that is presented:" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "33f34d12-79f4-4230-836b-2e66ea839440", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "TestListInt8UReverseResponse(\n",
-       "arg1=[\n",
-       "│   │   7,\n",
-       "│   │   5,\n",
-       "│   │   3,\n",
-       "│   │   1\n",
-       "]\n",
-       ")\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1;35mTestListInt8UReverseResponse\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[33marg1\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1;36m7\u001b[0m,\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1;36m5\u001b[0m,\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1;36m3\u001b[0m,\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m]\u001b[0m\n", - "\u001b[1m)\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.SendCommand(1, 1, Clusters.TestCluster.Commands.TestListInt8UReverseRequest([1, 3, 5, 7]))" - ] - }, - { - "cell_type": "markdown", - "id": "820fcede", - "metadata": { - "tags": [] - }, - "source": [ - "### Read out the Fabric List to validate" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "765fe963-80a6-41f6-a569-df5d71c6822c", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "0: {\n",
-       "│   │   <class 'chip.clusters.Objects.OperationalCredentials'>: {\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'>: [\n",
-       "│   │   │   │   FabricDescriptor(\n",
-       "│   │   │   │   │   fabricIndex=1,\n",
-       "│   │   │   │   │   rootPublicKey=b'\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6]BN\\rS=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao}\\xcc\\xce<\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc',\n",
-       "│   │   │   │   │   vendorId=26464,\n",
-       "│   │   │   │   │   fabricId=1,\n",
-       "│   │   │   │   │   nodeId=1,\n",
-       "│   │   │   │   │   label=''\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.SupportedFabrics'>: 16,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'>: 1,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'>: [\n",
-       "│   │   │   │   b'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x01\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x01\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6]BN\\rS=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao}\\xcc\\xce<\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc7\\n5\\x01)\\x01\\x18$\\x02`0\\x04\\x14q9\\x96)~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf50\\x05\\x14q9\\x96)~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf5\\x180\\x0b@\\x13K\\x909\\xd6\\xf2\\xbb\\x1c\\\\R/E\\xe7\\x00y\\xbf^d8\\x05\\x89\\x8c\\xbeK\\x14O\\xac\\x8c\\xd44\\x93\\n\\xb1\\xe6k\\xa7\\x9c\\xdc\\xc5\\xffR,\\xcc\\xb5\\xc4\\x84\\x01\\x92\\x9d.\\x9b\\xda\\x0f\\x1d\\xa2\\xccEz-\\x13\\x05\\x12\\x1d\\xcb\\x18'\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CurrentFabricIndex'>: 1,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'>: 1\n",
-       "│   │   }\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m0\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mFabricDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricIndex\u001b[0m=\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrootPublicKey\u001b[0m=\u001b[32mb\u001b[0m\u001b[32m'\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6\u001b[0m\u001b[32m]\u001b[0m\u001b[32mBN\\\u001b[0m\u001b[32mrS\u001b[0m\u001b[32m=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\xcc\\xce\u001b[0m\u001b[32m<\u001b[0m\u001b[32m\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc'\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mvendorId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m26464\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mnodeId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mlabel\u001b[0m\u001b[39m=\u001b[0m\u001b[32m''\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;39m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[39m\u001b[0m: \u001b[1;36m16\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[32mb'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x01\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x01\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6\u001b[0m\u001b[32m]\u001b[0m\u001b[32mBN\\\u001b[0m\u001b[32mrS\u001b[0m\u001b[32m=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\xcc\\xce\u001b[0m\u001b[32m<\u001b[0m\u001b[32m\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc7\\n5\\x01\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\x01\\x18$\\x02`0\\x04\\x14q9\\x96\u001b[0m\u001b[32m)\u001b[0m\u001b[32m~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf50\\x05\\x14q9\\x96\u001b[0m\u001b[32m)\u001b[0m\u001b[32m~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf5\\x180\\x0b@\\x13K\\x909\\xd6\\xf2\\xbb\\x1c\\\\R/E\\xe7\\x00y\\xbf^d8\\x05\\x89\\x8c\\xbeK\\x14O\\xac\\x8c\\xd44\\x93\\n\\xb1\\xe6k\\xa7\\x9c\\xdc\\xc5\\xffR,\\xcc\\xb5\\xc4\\x84\\x01\\x92\\x9d.\\x9b\\xda\\x0f\\x1d\\xa2\\xccEz-\\x13\\x05\\x12\\x1d\\xcb\\x18'\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[39m\u001b[0m: \u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.ReadAttribute(1, [(Clusters.OperationalCredentials)])" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "6802862a", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "0: {\n",
-       "│   │   <class 'chip.clusters.Objects.Descriptor'>: Descriptor(\n",
-       "│   │   │   deviceList=[\n",
-       "│   │   │   │   DeviceType(\n",
-       "│   │   │   │   │   type=22,\n",
-       "│   │   │   │   │   revision=1\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   serverList=[\n",
-       "│   │   │   │   3,\n",
-       "│   │   │   │   4,\n",
-       "│   │   │   │   29,\n",
-       "│   │   │   │   30,\n",
-       "│   │   │   │   31,\n",
-       "│   │   │   │   40,\n",
-       "│   │   │   │   41,\n",
-       "│   │   │   │   42,\n",
-       "│   │   │   │   46,\n",
-       "│   │   │   │   48,\n",
-       "│   │   │   │   49,\n",
-       "│   │   │   │   50,\n",
-       "│   │   │   │   51,\n",
-       "│   │   │   │   52,\n",
-       "│   │   │   │   53,\n",
-       "│   │   │   │   54,\n",
-       "│   │   │   │   55,\n",
-       "│   │   │   │   60,\n",
-       "│   │   │   │   62,\n",
-       "│   │   │   │   63,\n",
-       "│   │   │   │   64,\n",
-       "│   │   │   │   65,\n",
-       "│   │   │   │   1029\n",
-       "│   │   │   ],\n",
-       "│   │   │   clientList=[],\n",
-       "│   │   │   partsList=[\n",
-       "│   │   │   │   1,\n",
-       "│   │   │   │   2\n",
-       "│   │   │   ],\n",
-       "│   │   │   attributeList=None,\n",
-       "│   │   │   featureMap=None,\n",
-       "│   │   │   clusterRevision=1\n",
-       "│   │   )\n",
-       "},\n",
-       "1: {\n",
-       "│   │   <class 'chip.clusters.Objects.Descriptor'>: Descriptor(\n",
-       "│   │   │   deviceList=[\n",
-       "│   │   │   │   DeviceType(\n",
-       "│   │   │   │   │   type=22,\n",
-       "│   │   │   │   │   revision=1\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   serverList=[\n",
-       "│   │   │   │   3,\n",
-       "│   │   │   │   4,\n",
-       "│   │   │   │   5,\n",
-       "│   │   │   │   6,\n",
-       "│   │   │   │   7,\n",
-       "│   │   │   │   8,\n",
-       "│   │   │   │   15,\n",
-       "│   │   │   │   29,\n",
-       "│   │   │   │   30,\n",
-       "│   │   │   │   37,\n",
-       "│   │   │   │   47,\n",
-       "│   │   │   │   57,\n",
-       "│   │   │   │   59,\n",
-       "│   │   │   │   64,\n",
-       "│   │   │   │   65,\n",
-       "│   │   │   │   69,\n",
-       "│   │   │   │   80,\n",
-       "│   │   │   │   257,\n",
-       "│   │   │   │   258,\n",
-       "│   │   │   │   259,\n",
-       "│   │   │   │   512,\n",
-       "│   │   │   │   513,\n",
-       "│   │   │   │   516,\n",
-       "│   │   │   │   768,\n",
-       "│   │   │   │   1024,\n",
-       "│   │   │   │   1026,\n",
-       "│   │   │   │   1027,\n",
-       "│   │   │   │   1028,\n",
-       "│   │   │   │   1029,\n",
-       "│   │   │   │   1030,\n",
-       "│   │   │   │   1280,\n",
-       "│   │   │   │   1283,\n",
-       "│   │   │   │   1284,\n",
-       "│   │   │   │   1285,\n",
-       "│   │   │   │   1286,\n",
-       "│   │   │   │   1287,\n",
-       "│   │   │   │   1288,\n",
-       "│   │   │   │   1289,\n",
-       "│   │   │   │   1290,\n",
-       "│   │   │   │   1291,\n",
-       "│   │   │   │   1292,\n",
-       "│   │   │   │   1293,\n",
-       "│   │   │   │   1294,\n",
-       "│   │   │   │   1295,\n",
-       "│   │   │   │   2820\n",
-       "│   │   │   ],\n",
-       "│   │   │   clientList=[],\n",
-       "│   │   │   partsList=[],\n",
-       "│   │   │   attributeList=None,\n",
-       "│   │   │   featureMap=None,\n",
-       "│   │   │   clusterRevision=1\n",
-       "│   │   )\n",
-       "},\n",
-       "2: {\n",
-       "│   │   <class 'chip.clusters.Objects.Descriptor'>: Descriptor(\n",
-       "│   │   │   deviceList=[\n",
-       "│   │   │   │   DeviceType(\n",
-       "│   │   │   │   │   type=22,\n",
-       "│   │   │   │   │   revision=1\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   serverList=[\n",
-       "│   │   │   │   4,\n",
-       "│   │   │   │   6,\n",
-       "│   │   │   │   29,\n",
-       "│   │   │   │   1030\n",
-       "│   │   │   ],\n",
-       "│   │   │   clientList=[],\n",
-       "│   │   │   partsList=[],\n",
-       "│   │   │   attributeList=None,\n",
-       "│   │   │   featureMap=None,\n",
-       "│   │   │   clusterRevision=1\n",
-       "│   │   )\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m0\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.Descriptor'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;35mDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mdeviceList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mDeviceType\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mtype\u001b[0m=\u001b[1;36m22\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mserverList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m3\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m4\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m29\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m30\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m31\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m40\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m41\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m42\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m46\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m48\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m49\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m50\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m51\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m52\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m53\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m54\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m55\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m60\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m62\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m63\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m64\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m65\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1029\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclientList\u001b[0m=\u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mpartsList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m2\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mattributeList\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mfeatureMap\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclusterRevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m1\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.Descriptor'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;35mDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mdeviceList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mDeviceType\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mtype\u001b[0m=\u001b[1;36m22\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mserverList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m3\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m4\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m5\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m6\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m7\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m8\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m15\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m29\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m30\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m37\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m47\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m57\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m59\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m64\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m65\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m69\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m80\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m257\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m258\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m259\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m512\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m513\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m516\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m768\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1024\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1026\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1027\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1028\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1029\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1030\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1280\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1283\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1284\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1285\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1286\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1287\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1288\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1289\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1290\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1291\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1292\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1293\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1294\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1295\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m2820\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclientList\u001b[0m=\u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mpartsList\u001b[0m=\u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mattributeList\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mfeatureMap\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclusterRevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m2\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.Descriptor'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;35mDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mdeviceList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mDeviceType\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mtype\u001b[0m=\u001b[1;36m22\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mserverList\u001b[0m=\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m4\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m6\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m29\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;36m1030\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclientList\u001b[0m=\u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mpartsList\u001b[0m=\u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mattributeList\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mfeatureMap\u001b[0m=\u001b[3;35mNone\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[33mclusterRevision\u001b[0m=\u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m)\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl.ReadAttribute(1, [(Clusters.Descriptor)], True)" - ] - }, - { - "cell_type": "markdown", - "id": "dbade62b", - "metadata": {}, - "source": [ - "Note that the `FabricsList` contains just a single item with a `fabriIndex` of 1, and a `fabricId` of 1." - ] - }, - { - "cell_type": "markdown", - "id": "7326ae6a", - "metadata": { - "tags": [] - }, - "source": [ - "### Create Controller on Fabric B" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "a975776b", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "[\n",
-       "1,\n",
-       "2,\n",
-       "3,\n",
-       "4\n",
-       "]\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m2\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m3\u001b[0m,\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m4\u001b[0m\n", - "\u001b[1m]\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "a = [1, 2, 3, 4]\n", - "a" - ] - }, - { - "cell_type": "markdown", - "id": "72b857b3", - "metadata": {}, - "source": [ - "### Open Commissioning Window\n", - "\n", - "The target right now doesn't accept commissioning requests. So let's go ahead and open the commissioning window to permit the second controller on Fabric B to commission the target. This request has to originate from the 1st controller." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "f4fca3f4", - "metadata": {}, - "outputs": [], - "source": [ - "await devCtrl.SendCommand(1, 0, Clusters.AdministratorCommissioning.Commands.OpenBasicCommissioningWindow(100))" - ] - }, - { - "cell_type": "markdown", - "id": "b7b2215e", - "metadata": {}, - "source": [ - "### Commission Target on Fabric B" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "41255a44", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2021-12-30 21:35:59 johnsj-macbookpro1.roam.corp.google.com chip.CTL[58883] ERROR Unable to find country code, defaulting to WW\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Established CASE with Device\n" - ] - }, - { - "data": { - "text/html": [ - "
True\n",
-       "
\n" - ], - "text/plain": [ - "\u001b[3;92mTrue\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Node address has been updated\n", - "Commissioning complete\n" - ] - } - ], - "source": [ - "devCtrl2.CommissionIP(b'127.0.0.1', 20202021, 1)" - ] - }, - { - "cell_type": "markdown", - "id": "b17289ff", - "metadata": {}, - "source": [ - "### Read out the Fabric List to validate" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "903cb0fd", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n",
-       "{\n",
-       "0: {\n",
-       "│   │   <class 'chip.clusters.Objects.OperationalCredentials'>: {\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'>: [\n",
-       "│   │   │   │   FabricDescriptor(\n",
-       "│   │   │   │   │   fabricIndex=1,\n",
-       "│   │   │   │   │   rootPublicKey=b'\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6]BN\\rS=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao}\\xcc\\xce<\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc',\n",
-       "│   │   │   │   │   vendorId=26464,\n",
-       "│   │   │   │   │   fabricId=1,\n",
-       "│   │   │   │   │   nodeId=1,\n",
-       "│   │   │   │   │   label=''\n",
-       "│   │   │   │   ),\n",
-       "│   │   │   │   FabricDescriptor(\n",
-       "│   │   │   │   │   fabricIndex=2,\n",
-       "│   │   │   │   │   rootPublicKey=b'\\x04G+A\\xc6\\x15\\xb0\\xa6\\x1e\\xb2_J\\x8e\\xb1b\\xc6\\x16\\xcd\\xa8\\xe63\\x98\\xb8\\x7fr\\x9a\\xfe\\x01#\\xe0\\x8fw4\\xc1[\\x17\\xd1\\x81.\\xa0\\r\\x90\\xef|\\xf2\\xe3\\xe3\\xf6\\x82\\x91@U\\x90N\\xbd\\xdb\\xb2 h\\r\\x10w\\xf69\\x93',\n",
-       "│   │   │   │   │   vendorId=26464,\n",
-       "│   │   │   │   │   fabricId=2,\n",
-       "│   │   │   │   │   nodeId=1,\n",
-       "│   │   │   │   │   label=''\n",
-       "│   │   │   │   )\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.SupportedFabrics'>: 16,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'>: 2,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'>: [\n",
-       "│   │   │   │   b'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x01\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x01\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6]BN\\rS=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao}\\xcc\\xce<\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc7\\n5\\x01)\\x01\\x18$\\x02`0\\x04\\x14q9\\x96)~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf50\\x05\\x14q9\\x96)~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf5\\x180\\x0b@\\x13K\\x909\\xd6\\xf2\\xbb\\x1c\\\\R/E\\xe7\\x00y\\xbf^d8\\x05\\x89\\x8c\\xbeK\\x14O\\xac\\x8c\\xd44\\x93\\n\\xb1\\xe6k\\xa7\\x9c\\xdc\\xc5\\xffR,\\xcc\\xb5\\xc4\\x84\\x01\\x92\\x9d.\\x9b\\xda\\x0f\\x1d\\xa2\\xccEz-\\x13\\x05\\x12\\x1d\\xcb\\x18',\n",
-       "│   │   │   │   b'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x02\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x02\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04G+A\\xc6\\x15\\xb0\\xa6\\x1e\\xb2_J\\x8e\\xb1b\\xc6\\x16\\xcd\\xa8\\xe63\\x98\\xb8\\x7fr\\x9a\\xfe\\x01#\\xe0\\x8fw4\\xc1[\\x17\\xd1\\x81.\\xa0\\r\\x90\\xef|\\xf2\\xe3\\xe3\\xf6\\x82\\x91@U\\x90N\\xbd\\xdb\\xb2 h\\r\\x10w\\xf69\\x937\\n5\\x01)\\x01\\x18$\\x02`0\\x04\\x14\\xc6\\xb8;\\xbf\"u\\xb8f\"\\x99\\x10\\xc5o\\xdf\\xc4(\\x1b\\xbd\\xeeh0\\x05\\x14\\xc6\\xb8;\\xbf\"u\\xb8f\"\\x99\\x10\\xc5o\\xdf\\xc4(\\x1b\\xbd\\xeeh\\x180\\x0b@\\tQ;Y\\xb6\\x82I[\\x85k\\xfdot\\xb6\\x98\\x04\\x1d\\xf9SJ\\xf74\\xfa\\xbc\\xa1OWM\\xef\\xec\\xcf|\\xad[\\x17\\xd5/\\xa9\\xbb\\xb4\\xbc\\xb1\\xafa\\x06\\xdb\\xcd]E\\xdf\\x84\\xcf\\xb6\\x10\\xd9\\xc7\\xf5l\\xef\\x96K6\\xbd\\xa5\\x18'\n",
-       "│   │   │   ],\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.CurrentFabricIndex'>: 2,\n",
-       "│   │   │   <class 'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'>: 1\n",
-       "│   │   }\n",
-       "}\n",
-       "}\n",
-       "
\n" - ], - "text/plain": [ - "\n", - "\u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1;36m0\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m{\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mFabricDescriptor\u001b[0m\u001b[1m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricIndex\u001b[0m=\u001b[1;36m1\u001b[0m,\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrootPublicKey\u001b[0m=\u001b[32mb\u001b[0m\u001b[32m'\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6\u001b[0m\u001b[32m]\u001b[0m\u001b[32mBN\\\u001b[0m\u001b[32mrS\u001b[0m\u001b[32m=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\xcc\\xce\u001b[0m\u001b[32m<\u001b[0m\u001b[32m\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc'\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mvendorId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m26464\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mnodeId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mlabel\u001b[0m\u001b[39m=\u001b[0m\u001b[32m''\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;35mFabricDescriptor\u001b[0m\u001b[1;39m(\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricIndex\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m2\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mrootPublicKey\u001b[0m\u001b[39m=\u001b[0m\u001b[32mb\u001b[0m\u001b[32m'\\x04G+A\\xc6\\x15\\xb0\\xa6\\x1e\\xb2_J\\x8e\\xb1b\\xc6\\x16\\xcd\\xa8\\xe63\\x98\\xb8\\x7fr\\x9a\\xfe\\x01#\\xe0\\x8fw4\\xc1\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\x17\\xd1\\x81.\\xa0\\r\\x90\\xef|\\xf2\\xe3\\xe3\\xf6\\x82\\x91@U\\x90N\\xbd\\xdb\\xb2 h\\r\\x10w\\xf69\\x93'\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mvendorId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m26464\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mfabricId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m2\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mnodeId\u001b[0m\u001b[39m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ │ \u001b[0m\u001b[33mlabel\u001b[0m\u001b[39m=\u001b[0m\u001b[32m''\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[1;39m)\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[39m\u001b[0m: \u001b[1;36m16\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m2\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1m[\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[32mb'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x01\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x01\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04b\\xeeV\\x80\\x01\\xee\\xab1\\x0f|\\x01\\xc1\\xaf5\\x14\\xf0\\x18\\x8f\\xa2\\xa3\\xa8\\x8b \\x0c\\x8c\\xd5\\xb0\\xf6\u001b[0m\u001b[32m]\u001b[0m\u001b[32mBN\\\u001b[0m\u001b[32mrS\u001b[0m\u001b[32m=\\xa4U\\xeb\\xf5\\x82\\xbbdKU\\xc8\\xe9\\x16\\xeao\u001b[0m\u001b[32m}\u001b[0m\u001b[32m\\xcc\\xce\u001b[0m\u001b[32m<\u001b[0m\u001b[32m\\xbf^\\xd5\\xa5\\x06,L\\x93\\x1dX\\xc5\\xfc7\\n5\\x01\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\x01\\x18$\\x02`0\\x04\\x14q9\\x96\u001b[0m\u001b[32m)\u001b[0m\u001b[32m~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf50\\x05\\x14q9\\x96\u001b[0m\u001b[32m)\u001b[0m\u001b[32m~h\\xbc\\x04:\\xc5\\x12\\xeb\\xa8\\x16y\\xd4\\xb2C\\xba\\xf5\\x180\\x0b@\\x13K\\x909\\xd6\\xf2\\xbb\\x1c\\\\R/E\\xe7\\x00y\\xbf^d8\\x05\\x89\\x8c\\xbeK\\x14O\\xac\\x8c\\xd44\\x93\\n\\xb1\\xe6k\\xa7\\x9c\\xdc\\xc5\\xffR,\\xcc\\xb5\\xc4\\x84\\x01\\x92\\x9d.\\x9b\\xda\\x0f\\x1d\\xa2\\xccEz-\\x13\\x05\\x12\\x1d\\xcb\\x18'\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ │ \u001b[0m\u001b[32mb'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x02\\x18&\\x04\\x80\"\\x81\\'&\\x05\\x80%M:7\\x06$\\x14\\x00$\\x15\\x02\\x18$\\x07\\x01$\\x08\\x010\\tA\\x04G+A\\xc6\\x15\\xb0\\xa6\\x1e\\xb2_J\\x8e\\xb1b\\xc6\\x16\\xcd\\xa8\\xe63\\x98\\xb8\\x7fr\\x9a\\xfe\\x01#\\xe0\\x8fw4\\xc1\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\x17\\xd1\\x81.\\xa0\\r\\x90\\xef|\\xf2\\xe3\\xe3\\xf6\\x82\\x91@U\\x90N\\xbd\\xdb\\xb2 h\\r\\x10w\\xf69\\x937\\n5\\x01\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\x01\\x18$\\x02`0\\x04\\x14\\xc6\\xb8;\\xbf\"u\\xb8f\"\\x99\\x10\\xc5o\\xdf\\xc4\u001b[0m\u001b[32m(\u001b[0m\u001b[32m\\x1b\\xbd\\xeeh0\\x05\\x14\\xc6\\xb8;\\xbf\"u\\xb8f\"\\x99\\x10\\xc5o\\xdf\\xc4\u001b[0m\u001b[32m(\u001b[0m\u001b[32m\\x1b\\xbd\\xeeh\\x180\\x0b@\\tQ;Y\\xb6\\x82I\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\x85k\\xfdot\\xb6\\x98\\x04\\x1d\\xf9SJ\\xf74\\xfa\\xbc\\xa1OWM\\xef\\xec\\xcf|\\xad\u001b[0m\u001b[32m[\u001b[0m\u001b[32m\\x17\\xd5/\\xa9\\xbb\\xb4\\xbc\\xb1\\xafa\\x06\\xdb\\xcd\u001b[0m\u001b[32m]\u001b[0m\u001b[32mE\\xdf\\x84\\xcf\\xb6\\x10\\xd9\\xc7\\xf5l\\xef\\x96K6\\xbd\\xa5\\x18'\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[39m\u001b[0m: \u001b[1;36m2\u001b[0m,\n", - "\u001b[2;32m│ │ │ \u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'\u001b[0m\u001b[1m>\u001b[0m: \u001b[1;36m1\u001b[0m\n", - "\u001b[2;32m│ │ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[2;32m│ \u001b[0m\u001b[1m}\u001b[0m\n", - "\u001b[1m}\u001b[0m\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "await devCtrl2.ReadAttribute(1, [(Clusters.OperationalCredentials)])" - ] - }, - { - "cell_type": "markdown", - "id": "ebf71c37", - "metadata": {}, - "source": [ - "Note that the FabricsList contains two items now!" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "matter-env-2", - "language": "python", - "name": "matter-env-2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.2+chromium.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}