blob: c7f92aa331d5f63835d4982906936ecf8e2afe7a [file] [log] [blame]
{
"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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #00ff00; text-decoration-color: #00ff00\">──────────────────────────────────────── </span>Matter REPL<span style=\"color: #00ff00; text-decoration-color: #00ff00\"> ────────────────────────────────────────</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[92m──────────────────────────────────────── \u001b[0mMatter REPL\u001b[92m ────────────────────────────────────────\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
" \n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> </span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> Welcome to the Matter Python REPL!</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> </span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> For help, please type </span><span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">matterhelp()</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> </span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> To get more information on a particular object/class, you can pass</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> that into </span><span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">matterhelp()</span><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> as well.</span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> </span>\n",
"<span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\"> </span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #00ff00; text-decoration-color: #00ff00\">─────────────────────────────────────────────────────────────────────────────────────────────</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">subprocess.Popen</span><span style=\"color: #000000; text-decoration-color: #000000\"> object at </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0x10d12db50</span><span style=\"font-weight: bold\">&gt;</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"<span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>: <span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.FabricsList'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">[</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ </span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">FabricDescriptor</span><span style=\"font-weight: bold\">(</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">fabricIndex</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">rootPublicKey</span>=<span style=\"color: #008000; text-decoration-color: #008000\">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'</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">vendorId</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">27424</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">fabricId</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">nodeId</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">label</span>=<span style=\"color: #008000; text-decoration-color: #008000\">''</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ </span><span style=\"font-weight: bold\">)</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">]</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.SupportedFabrics'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">16</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.CommissionedFabrics'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.TrustedRootCertificates'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">[</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ │ </span><span style=\"color: #008000; text-decoration-color: #008000\">b'\\x150\\x01\\x01\\x00$\\x02\\x017\\x03$\\x14\\x00$\\x15\\x03\\x18&amp;\\x04\\x80\"\\x81\\'&amp;\\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'</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">]</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.CurrentFabricIndex'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OperationalCredentials.Attributes.ClusterRevision'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">}</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"<span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>: <span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.AccessControl'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.AccessControl.Attributes.Acl'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">[]</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.AccessControl.Attributes.Extension'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"font-weight: bold\">[]</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.AccessControl.Attributes.ClusterRevision'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">}</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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<module>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">Subscription</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #000000; text-decoration-color: #000000; font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">Id</span><span style=\"color: #000000; text-decoration-color: #000000\">=</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13932082784090111118</span><span style=\"color: #000000; text-decoration-color: #000000; font-weight: bold\">)</span><span style=\"font-weight: bold\">&gt;</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
"<span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>: <span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.LevelControl'</span><span style=\"font-weight: bold\">&gt;</span>: <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">LevelControl</span><span style=\"font-weight: bold\">(</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">currentLevel</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">remainingTime</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">minLevel</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">maxLevel</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">255</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">currentFrequency</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">minFrequency</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">maxFrequency</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">options</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">onOffTransitionTime</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">onLevel</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">254</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">onTransitionTime</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">offTransitionTime</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">defaultMoveRate</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">startUpCurrentLevel</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">attributeList</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">featureMap</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">clusterRevision</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ │ </span><span style=\"font-weight: bold\">)</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"font-weight: bold\">}</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OnOff.Attributes.OnTime'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OnOff.Attributes.OnOff'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #ff0000; text-decoration-color: #ff0000; font-style: italic\">False</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OnOff.Attributes.OnTime'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.OnOff.Attributes.OnOff'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #ff0000; text-decoration-color: #ff0000; font-style: italic\">False</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">{</span>\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Endpoint'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Attribute'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">class</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
"<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│ </span><span style=\"color: #008000; text-decoration-color: #008000\">'Value'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">100</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\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
}