Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save oidebrett/c83185ee47d1d355e2dc9f1e035ef921 to your computer and use it in GitHub Desktop.

Select an option

Save oidebrett/c83185ee47d1d355e2dc9f1e035ef921 to your computer and use it in GitHub Desktop.
Accessing Matter Attributes using Python and the Matter SDK
# Import the core chip libraries of Attribute and Clusters
from chip.clusters import Attribute, Objects as Clusters
# Import the required clusters
from chip.clusters.Objects import Binding, BasicInformation
# Fetch attributes
allAttributes = await devCtrl.ReadAttribute(1, [('*')])
firstResult = allAttributes[0]
# Access specific class entries
binding_data = firstResult.get(Binding, "No Binding data available")
basic_info = firstResult.get(BasicInformation, "No Basic Information available")
# Print and explore the data
print("Binding Data:", binding_data)
print("Basic Information Data:", basic_info)
# Iterating over all keys and values
for cls_key, value in firstResult.items():
print(f"Class: {cls_key}, Value: {value}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment