# Package com.codename1.home.commissioning

package com.codename1.home.commissioning

Adding a new Matter accessory to the user's home.

Start from `SmartHome.getCommissioner()`, which never returns `null` and answers `Commissioner.isSupported()` `false` where there is nothing behind it.

##### Its own package on purpose

The build server decides what native machinery an app gets by scanning its bytecode for package prefixes, and commissioning is much more expensive than the rest of this API: on iOS it needs the `MatterSupport` framework, a `com.apple.developer.matter.allow-setup-payload` entitlement, an app group and a whole generated app-extension target, and on Android it adds the Play services home dependency and Bluetooth and local-network permissions.

An app that reads its lights and never adds an accessory should get none of that. Because the scanner matches on a package prefix and has no way to express an exclusion, the only way to make that separation possible is for the package boundary to be the permission boundary -- so commissioning lives here rather than next to `SmartHome`.

##### What commissioning does not promise

Adding an accessory puts it in the user's ecosystem. Whether your app can then control it is a different question, and on Android with Play services alone the answer is no. Check `CommissioningResult.wasCommissionedToThisApp()` rather than assuming the returned accessory id is usable.

- Related Packages
  Package
  Description
  com.codename1.home
  A cross-platform smart-home API: read the home's accessories, read and write what they can do, watch them for change, run scenes, and add new Matter accessories.
  com.codename1.home.spi
  The service-provider interface each platform port implements to back `SmartHome`.
- Class
  Description
  Commissioner
  Adds a new Matter accessory to the user's home.
  CommissioningRequest
  What to add, and where the user would like it to land.
  CommissioningResult
  What came of a commissioning attempt.
  CommissioningStyle
  How a backend adds a new accessory, so an app can word its own button honestly.
  SetupPayload
  A Matter onboarding payload: the `MT:` string behind the QR code on an accessory, or the 11 or 21 digit code printed under it.