Dashboard Card SDK Usage
Revision History
| Date | Version | Changes |
|---|---|---|
| 2026.04.06 | v1.0.1 | Added IALinkCallBack interface notes, including push callbacks, data read proxies, trait writes, and command dispatch |
| 2026.03.31 | v1.0.0 | Added the Dashboard Card SDK usage guide and documented the new IHomeConfigurationCallback and IPanelPermissionStrategy integration approach |
1. Overview
This document describes how to integrate the pages, navigation callbacks, resource extension capabilities, and Aqara Spec data notification and control capabilities provided by the Dashboard Card SDK based on the host project's MainActivity, initHome(), and host callback and strategy implementations.
2. Prerequisites
- Complete the preparation work
- Complete the environment setup
- Complete the integration of the Dashboard Card SDK
3. Usage
3.1 Open the Dashboard Card Page
The host entry page usually determines the current device form first, initializes the Home module, and then loads the home homepage HomeMainFragment:
class MainActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// 1. Set phone / tablet mode
LumiRouterManager.instance.isTablet =
resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
// 2. Initialize the home capability
initHome()
// 3. Load the home homepage
startHome()
}
open fun startHome() {
loadRootFragment(R.id.fl_container, HomeMainFragment())
}
}
Key Parameters
| Field | Type | Description | Source |
|---|---|---|---|
context |
Activity |
Host entry page | Host app |
HomeMainFragment |
Fragment |
Home homepage container | Provided by the SDK |
R.id.fl_container |
Int |
Page container ID | Must be reserved by the host layout |
If you need to navigate to other pages such as the Service Square or card list, you can follow the host implementation pattern of ARouter.build(...).withString(PATH_KEY, ...).navigation() and replace the target path as needed.
3.2 Dashboard Navigation Callback
3.2.1 Callback Overview
Capabilities such as card click handling, page navigation, offline handling, and web page opening are recommended to be provided to the host through IHomeConfigurationCallback.
The recommended approach is:
- The host implements a callback class, for example
HomeCallBack - The callback class implements
IHomeConfigurationCallback - The callback is exposed to the dashboard module through ARouter
IHomeConfigurationCallback is the unified navigation interface exposed by the dashboard module to the host. Card clicks, page transitions, offline handling, web page opening, and theme changes are eventually passed back through this interface.
3.2.2 IHomeConfigurationCallback Interface
The key characteristics of this interface are:
- It inherits from
IProviderand is discovered through ARouter - Most business entities are passed through as
Any, and the host must cast them to the actual types - The dashboard module calls this interface through a unified routing layer without directly depending on host business pages
Common methods and parameter conventions are as follows:
| Method | Parameter Description | Actual Type or Usage |
|---|---|---|
gotoDeviceHomePage(context, endPointEx) |
Navigate to a device page | endPointEx is actually EndPointEx |
gotoSceneHomePage(context, entity) |
Navigate to a scene page | entity is actually PanelBoardEntity |
gotoAutomationHomePage(context, entity) |
Navigate to an automation page | entity is actually PanelBoardEntity |
gotoOfflinePage(context, endPointEx, showDialog) |
Offline diagnostic or offline page handling | endPointEx is actually EndPointEx, and showDialog controls whether to show a dialog |
gotoEnergyPage(context, entity) |
Navigate to an energy page | entity is actually PanelBoardEntity |
gotoHomeLocationPage(context, entity) |
Navigate to the home location page | entity is actually WeatherEntity |
gotoWebPage(context, url, title, isFullScreen) |
Open a web page | Uses URL, title, and full-screen flag directly |
onChangeTheme() |
Theme change callback | The host can perform theme synchronization |
gotoLANLinkPage(context, did, model) |
Navigate to the LAN link page | Depends on device did and model |
gotoLANSettingPage(context) |
Navigate to the LAN settings page | No additional business entity |
gotoVideoEventPage(context, homeId) |
Navigate to the video events page | Uses homeId to identify the home |
gotoServiceSquareDescPage(context, key) |
Navigate to the service square detail page | Uses key to identify the target content |
gotoMinePage(context) |
Navigate to the Mine page | Opens the personal center related page |
Additional notes:
- The dashboard module determines which callback method to invoke based on the card type
- For example, device cards call
gotoDeviceHomePage(...)and scene cards callgotoSceneHomePage(...) - The host must correctly recognize the real type behind each
Anyparameter in order to retrieve the passed business data
3.2.3 Integration Recommendations
- Review the host's existing pages and confirm the paths and parameters for device detail, home management, scenes, automations, and web containers
- Implement the actual navigation logic in the
IHomeConfigurationCallbackimplementation using ARouter or the host routing system - If the current project is display-oriented only, start with basic device, scene, and web navigation, and keep the remaining callbacks as placeholders
3.3 IALinkCallBack Interface
3.3.1 Interface Responsibilities
The Dashboard Card SDK connects to the host device link layer through IALinkCallBack to handle Aqara Spec related data notifications and control capabilities. The host usually needs to implement the following types of methods in this interface:
- Push callback methods for receiving real-time trait change notifications
- Data read proxy methods for reading current values by device, function, or trait
trait writemethods for modifying trait property values- Command dispatch methods for executing device commands that are independent of
trait write
3.3.2 Key Methods
| Method or Capability | Purpose | Description |
|---|---|---|
onTraitPush |
Push callback | Used to receive real-time Aqara Spec data notifications. When a device trait value changes, the host can parse the device identifier, trait identifier, and latest value in this callback, then trigger home card refreshes, cache updates, or business event distribution. |
read |
Data query | Used by the dashboard module to actively obtain the current device status, such as during first-screen rendering, refresh after returning to the foreground, or active card polling. The host can reuse the existing device center or local cache and return the latest trait data. |
write |
Property update | Used to modify the current value of a device trait. This applies to property update scenarios that map directly to traits, such as switch toggles, brightness adjustment, mode changes, and target temperature settings. The host should execute these requests through the Aqara Spec trait write path. |
cmd |
Command control | Used to execute device commands that are different from trait write, such as triggering one-time actions, sending execution commands, or invoking device command capabilities. This belongs to the command dispatch path and should not be mixed with trait property updates. |
3.3.3 Integration Recommendations
- Ensure that
IALinkCallBackis registered correctly and can be invoked through the unified device link layer - Use
onTraitPush(...)as the real-time update entry and prioritize it for passive refreshes triggered by device reports - Reuse the host's existing device cache, device center, or query APIs for read proxy methods whenever possible
- Route
trait writemethods through the host's existing write path so permission checks, throttling, logging, and retries can be handled consistently - Route command dispatch methods through an independent command control path and keep the implementation separate from
trait writeto avoid semantic confusion - If trait changes are frequent, add deduplication, throttling, or device-level merge refresh logic to reduce UI jitter and repeated rendering
3.3.4 Usage Notes
IALinkCallBackis the core interface for integrating Aqara Spec data notifications and control capabilities in the dashboard module- Push callbacks, data reads,
trait write, and command dispatch should be planned uniformly by the host, but implemented as separate paths trait writeis used for property updates, while command dispatch is used for independent device commands, and they are not the same control mode- If this interface is not implemented correctly, card refreshes may fail, first-screen status may be inaccurate, or control behavior may become inconsistent
3.4 Dashboard Feature Switches
3.4.1 IPanelPermissionStrategy Overview
Whether dashboard capabilities are shown, clickable, or editable is recommended to be controlled through IPanelPermissionStrategy.
This interface controls which features are visible or available on the Home Configuration pages, and the host can inject its own strategy during initialization.
LMHomeManager.getInstance().setPanelPermissionStrategy(object : IPanelPermissionStrategy {
override fun supportVoice() = false
override fun supportAddDeviceSceneAutomation() = true
override fun supportCardClick() = false
override fun supportEditCard() = true
override fun supportSwitchHome() = true
override fun supportStatistics() = true
override fun supportThemePanel() = false
override fun supportLAN() = true
override fun supportCardType() = getSupportCardType()
})
3.4.2 Common Strategy Items
| Method | Example Return Value | Meaning |
|---|---|---|
supportVoice() |
false |
Whether voice capability is shown |
supportAddDeviceSceneAutomation() |
true |
Whether adding devices, scenes, and automations is allowed |
supportCardClick() |
false |
Whether cards can be clicked for navigation |
supportEditCard() |
true |
Whether card editing is allowed |
supportSwitchHome() |
true |
Whether home switching is allowed |
supportStatistics() |
true |
Whether statistics capability is shown |
supportThemePanel() |
false |
Whether the theme panel is shown |
supportLAN() |
true |
Whether LAN-related content is shown |
supportCardType() |
getSupportCardType() |
Use the default supported card types or a custom whitelist |
3.4.3 Recommendations
If the project mainly focuses on dashboard content, the following switches should be confirmed first:
supportCardClick()decides whether cards can open details or trigger navigationsupportEditCard()decides whether users can edit cardssupportSwitchHome()decides whether switching across homes is allowedsupportCardType()decides which card types can be displayed on the dashboard
If your goal is display only with no navigation, you can set supportCardClick() to false and selectively keep editing and home switching enabled.
3.5 Resource Extension
3.5.1 Local Resource Extension (Optional)
If you need to override the default skins, images, or copywriting, you can place custom resources in the Demo resources or assets directories and inject them through extension points such as ThemeStyle.getInstance().getBaseThemePack() or ResourcesWrapper.
3.5.2 Remote Resources (Optional)
The Dashboard Card SDK supports delivering card skins, copywriting, and related resources through remote configuration. The current version is maintained by the internal configuration center. If you need external access, please contact business support.
The examples above are based on the Demo structure of the host project. You can trim them as needed, and by keeping the onCreate -> initHome -> startHome call chain, you can quickly launch the home homepage and the core dashboard card capabilities.