參考出處:
1. 《075367r03ZB_AFG-Home_Automation_Profile_for_Public_Download.pdf》
2. http://www.zigbee.org/zigbee-for-developers/applicationstandards/zigbeehomeautomation/
3. http://www.360doc.com/content/13/1211/21/14855936_336431501.shtml
正文:
1. 基本概念理解:
profile:可以理解成為了實現/規范化某個功能或應用而定義的一套規定。每個應用對應一個profile ID。分為公共profile和私有profile。如果對Bluetooth有一定的基礎,可以對比Bluetooth 的profile進行理解,概念基本上互通。
cluster:一個profile包含多個cluster。可以這樣理解,一個具體的profile,包含了很多特性對象及細節上的小規范,這個規范即稱為cluster。每個cluster有對應的cluster ID。每個cluster ID都是唯一的。
不同的cluster有不同的命令(command),除過命令,cluster還有對應的屬性(attribute)。命令和屬性都有對應的ID,每個cluster下,命令和屬性的ID必須是唯一的。
而不同的cluster下,命令和屬性ID可以重復。不同的profile下,cluster ID也可以重復。
例如:一個智能家居profile下的一個調光器,就是可以是一個cluster。而操作這個調光器,就需要很多命令,比如開、關、調大、調小等,這些都是command。
而一個調光器,都有一些當前的狀態和參數,比如當前是開狀態,從開到關需要多長時間等,這些統一起來為屬性。
ZHA:ZigBee Home Automation profile。 智能家居自動化profile,即規定了智能家居要做什么,其中的設備要遵守的規范協議,有了規范的標准化協議,各個廠家的智能設備才能協同工作,不同廠家的產品才能兼容使用。
2. HA profile支持的 Device ID
Zstack代碼中,在zcl_ha.h文件中有定義這些ID如下:
// Zigbee Home Automation Profile Identification
#define ZCL_HA_PROFILE_ID 0x0104
// Generic Device IDs
#define ZCL_HA_DEVICEID_ON_OFF_SWITCH 0x0000
#define ZCL_HA_DEVICEID_LEVEL_CONTROL_SWITCH 0x0001
#define ZCL_HA_DEVICEID_ON_OFF_OUTPUT 0x0002
#define ZCL_HA_DEVICEID_LEVEL_CONTROLLABLE_OUTPUT 0x0003
#define ZCL_HA_DEVICEID_SCENE_SELECTOR 0x0004
#define ZCL_HA_DEVICEID_CONFIGURATION_TOOL 0x0005
#define ZCL_HA_DEVICEID_REMOTE_CONTROL 0x0006
#define ZCL_HA_DEVICEID_COMBINED_INTERFACE 0x0007
#define ZCL_HA_DEVICEID_RANGE_EXTENDER 0x0008
#define ZCL_HA_DEVICEID_MAINS_POWER_OUTLET 0x0009
#define ZCL_HA_DEVICEID_DOOR_LOCK 0x000A
#define ZCL_HA_DEVICEID_DOOR_LOCK_CONTROLLER 0x000B
#define ZCL_HA_DEVICEID_SIMPLE_SENSOR 0x000C
#define ZCL_HA_DEVICEID_CONSUMPTION_AWARENESS_DEVICE 0x000D
#define ZCL_HA_DEVICEID_HOME_GATEWAY 0x0050
#define ZCL_HA_DEVICEID_SMART_PLUG 0x0051
#define ZCL_HA_DEVICEID_WHITE_GOODS 0x0052
#define ZCL_HA_DEVICEID_METER_INTERFACE 0x0053
// This is a reserved value which could be used for test purposes
#define ZCL_HA_DEVICEID_TEST_DEVICE 0x00FF
// Lighting Device IDs
#define ZCL_HA_DEVICEID_ON_OFF_LIGHT 0x0100
#define ZCL_HA_DEVICEID_DIMMABLE_LIGHT 0x0101
#define ZCL_HA_DEVICEID_COLORED_DIMMABLE_LIGHT 0x0102
#define ZCL_HA_DEVICEID_ON_OFF_LIGHT_SWITCH 0x0103
#define ZCL_HA_DEVICEID_DIMMER_SWITCH 0x0104
#define ZCL_HA_DEVICEID_COLOR_DIMMER_SWITCH 0x0105
#define ZCL_HA_DEVICEID_LIGHT_SENSOR 0x0106
#define ZCL_HA_DEVICEID_OCCUPANCY_SENSOR 0x0107
// Closures Device IDs
#define ZCL_HA_DEVICEID_SHADE 0x0200
#define ZCL_HA_DEVICEID_SHADE_CONTROLLER 0x0201
#define ZCL_HA_DEVICEID_WINDOW_COVERING_DEVICE 0x0202
#define ZCL_HA_DEVICEID_WINDOW_COVERING_CONTROLLER 0x0203
// HVAC Device IDs
#define ZCL_HA_DEVICEID_HEATING_COOLING_UNIT 0x0300
#define ZCL_HA_DEVICEID_THERMOSTAT 0x0301
#define ZCL_HA_DEVICEID_TEMPERATURE_SENSOR 0x0302
#define ZCL_HA_DEVICEID_PUMP 0x0303
#define ZCL_HA_DEVICEID_PUMP_CONTROLLER 0x0304
#define ZCL_HA_DEVICEID_PRESSURE_SENSOR 0x0305
#define ZCL_HA_DEVICEID_FLOW_SENSOR 0x0306
#define ZCL_HA_DEVICEID_MINI_SPLIT_AC 0x0307
// Intruder Alarm Systems (IAS) Device IDs
#define ZCL_HA_DEVICEID_IAS_CONTROL_INDICATING_EQUIPMENT 0x0400
#define ZCL_HA_DEVICEID_IAS_ANCILLARY_CONTROL_EQUIPMENT 0x0401
#define ZCL_HA_DEVICEID_IAS_ZONE 0x0402
#define ZCL_HA_DEVICEID_IAS_WARNING_DEVICE 0x0403
HA Profile下對應的cluster ID:
#define ZCL_CLUSTER_ID_HA_APPLIANCE_IDENTIFICATION 0x0B00
#define ZCL_CLUSTER_ID_HA_METER_IDENTIFICATION 0x0B01
#define ZCL_CLUSTER_ID_HA_APPLIANCE_EVENTS_ALERTS 0x0B02
#define ZCL_CLUSTER_ID_HA_APPLIANCE_STATISTICS 0x0B03
#define ZCL_CLUSTER_ID_HA_ELECTRICAL_MEASUREMENT 0x0B04
#define ZCL_CLUSTER_ID_HA_DIAGNOSTIC 0x0B