On Off Switch device has 6 clusters (see spec 7.4.1):
On Off Switch device sample
- Example
- Declaring clusters
ZB_ZCL_DECLARE_ON_OFF_SWITCH_CONFIGURATION_ATTRIB_LIST(switch_cfg_attr_list, &attr_switch_type, &attr_switch_actions);
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(basic_attr_list, &attr_zcl_version, &attr_power_source);
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &attr_identify_time);
#define HA_SWITCH_ENDPOINT 10
Registering device list Example of command handler
See ha/devices_generic sample
#define ZB_HA_DECLARE_ON_OFF_SWITCH_CLUSTER_LIST |
( |
|
cluster_list_name, |
|
|
|
on_off_switch_config_attr_list, |
|
|
|
basic_attr_list, |
|
|
|
identify_attr_list |
|
) |
| |
Declare cluster list for On/Off switch device.
- Parameters
-
cluster_list_name | - cluster list variable name |
on_off_switch_config_attr_list | - attribute list for On/off switch configuration cluster |
basic_attr_list | - attribute list for Basic cluster |
identify_attr_list | - attribute list for Identify cluster |
Declare On/Off Switch device context.
- Parameters
-
device_ctx | - device context variable name. |
ep_name | - endpoint variable name. |
#define ZB_HA_DECLARE_ON_OFF_SWITCH_EP |
( |
|
ep_name, |
|
|
|
ep_id, |
|
|
|
cluster_list |
|
) |
| |
Value:ZB_ZCL_DECLARE_ON_OFF_SWITCH_SIMPLE_DESC( \
ep_name, \
ep_id, \
ZB_HA_ON_OFF_SWITCH_IN_CLUSTER_NUM, \
ZB_HA_ON_OFF_SWITCH_OUT_CLUSTER_NUM);
\
ep_id, \
0, \
NULL, \
cluster_list, \
0, NULL, \
0, NULL)
ZCL cluster description.
Definition: zb_zcl_common.h:97
Definition: zboss_api_af.h:287
#define ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,ep_id,profile_id,reserved_length,reserved_ptr,cluster_number,cluster_list,simple_desc,rep_count,rep_ctx,lev_ctrl_count,lev_ctrl_ctx)
Initialize endpoint descriptor.
Definition: zboss_api_af.h:490
Definition: zboss_api_af.h:201
Declare endpoint for On/off Switch device.
- Parameters
-
ep_name | - endpoint variable name |
ep_id | - endpoint ID |
cluster_list | - endpoint cluster list |