class

Matter::Device::Base

Inherits Reference < Object

Base class for Matter device applications.

Provides:

  • Persistent storage + FabricTable
  • UDP transport + Protocol MessageHandler
  • Default Root Node clusters (including OperationalCredentials)
  • DescriptorCluster injection and auto-population
  • mDNS responder + lifecycle management (commissioning <-> operational)

Subclasses typically implement:

  • build_storage_manager
  • device_clusters (endpoint-specific clusters)
  • device identity getters (name/vendor/product/pin/discriminator)
  • optional hooks like started_commissioning_mode

Constructors

new(ip_addresses : Array(Socket::IPAddress) | Nil = nil, port : Int32 = 5540, hostname : String | Nil = nil)
Source

Instance methods

access_control
Source
add_endpoint(endpoint_id : UInt16, device_type : UInt32, clusters : Array(Cluster::Base), device_type_revision : UInt16 = 1_u16, notify_subscribers : Bool = true) : Bool

Adds a new endpoint with the given clusters at runtime. This is primarily used by bridge devices to add bridged endpoints dynamically.

The clusters should already be configured with the correct endpoint_id. A DescriptorCluster will be automatically injected if not provided.

Set notify_subscribers to false when restoring endpoints from storage to avoid sending spurious subscription updates on startup.

Returns true if the endpoint was added successfully, false if it already exists.

Source
administrator_commissioning
Source
await_shutdown

Blocks until shutdown! is called. Optional - use when you need the main fiber to wait for shutdown (e.g., in a daemon or CLI application). Multiple fibers can safely wait on this.

Source
basic_info
Source
device_name

Required device identity

Source
discriminator
Source
endpoint_ids

Returns all endpoint IDs currently registered (excluding endpoint 0)

Source
fabric_table
Source
general_commissioning
Source
hardware_version
Source
hardware_version_string
Source
hostname
Source
ip_addresses
Source
lifecycle
Source
message_handler
Source
next_endpoint_id

Returns the next available endpoint ID for dynamic endpoints Starts from 1 and finds the first unused ID

Source
operational_credentials
Source
port
Source
primary_device_type_id
Source
product_appearance
Source
product_id
Source
product_name
Source
remove_endpoint(endpoint_id : UInt16) : Bool

Removes an endpoint and all its clusters at runtime. This is primarily used by bridge devices to remove bridged endpoints dynamically.

Returns true if the endpoint was removed, false if it didn't exist.

Source
responder
Source
serial_number
Source
setup_pin
Source
shutdown!

Signals shutdown, stops all services, and unblocks all await_shutdown waiters. Safe to call from signal handlers or other fibers.

Source
software_version
Source
software_version_string
Source
start

Starts mDNS and UDP transport and syncs advertisements for the current fabric set. Returns immediately after starting - use await_shutdown to block until shutdown.

Source
storage_manager
Source
transport
Source
unique_id
Source
update_hostname(hostname : String) : Nil

Updates the default commissioning target hostname used for mDNS advertisements. This is useful for platforms that rotate link-layer identifiers or for hosting multiple virtual devices in one executable.

Source
vendor_id
Source
vendor_name

Optional identity / BasicInformation fields

Source