【转】zigbee之group与scene

2019-07-20 17:18发布

group     首先是建组;第一步:通过配置终端(带可视化界面,通过主控它知道当前网络中所有设备的地址)下发命令到主控,主控转发到Z接口模块,最后到coordinator,这条命令中包含了所有要建组的设备ID和地址,还有组ID等,到coordinator后,解析这条命令,这个时候下面的终端设备还没有这个组的信息,所以coordinator不会组播,会解析这条命令后,根据endpoint地址单独发送建组请求命令到需要家组的endpoint,在endpoint建组并保持组ID的信息到本地组表;
                        第二步:建组成功了后,主控再次发送具体操作组的命令到coordinator时才会组播到各个该组的endpoint。
    与之前理解有点出入,开始理解的是没有开始的单播过程了,直接从主控发建组的命令到协调器就开始组表建组,但开始的时候,各endpoint是没有组的信息的,需要单播建立组后,具体的操作该组命令(例如关闭一组灯泡)才是在协调器发送组播信息。

   另外:1)同一个组中既可以有server,也可以有client(例如:三个灯和两个开关建组,在灯的组应答回调函数中实现开关簇的incluster操作;在开关的组应答回调函数中实现outcluster。但是这样做不好,开关不应该加入该组,在该组中没有什么意义,灯的具体开关操作不是通过这些开关设备来控制,而是上层主控下发下来的)。
                2)一个组中可以包含多个簇,(例如:一个dimmer灯和几个普通灯组成一组,dimmer灯有两种簇:开关簇和dimmer簇,普通灯只有开关簇。假如在这个组上建一个看电视的情景——关闭所有普通灯和调光灯到30%,则在普通灯的recall回调函数中实现关操作,在dimmer灯的recall的回到函数中实现开关操作,并执行dimmer操作)

group是将一些节点分到一个群组中;
在节点分到一个群组之后,就可以在节点上建立scene;在建立scene的时候group ID是一个参数,所以必须先有group才能有scene。
ZCL中,scene有add,recall,remove等管理函数,比如你给一个节点发送一个命令让他add到一个scene中,你在scene的回调函数中就需要填一下存的是哪些个atrribute,然后在recall的回调函数中根据add时候的attribute来设置你被控节点的状态。add的时候把被控设备放置到你想要的状态,然后add,然后store,可以了。
恢复情境的时候调用recall啊。
store和recall的时候会有一个回调函数,回调函数中实现你真正地设备控制状态恢复。
SceneENG:
In most cases scenes are associated with a particular group ID. Scenes may also
exist without a group, in which case the value 0x0000 replaces the group ID. Note
that extra care is required in these cases to avoid a scene ID collision, and that
commands related to scenes without a group may only be unicast, i.e.: they may
not be multicast or broadcast.
CHI:
在绝大多数情况下,情景和一个特定的GroupID关联在一起,情景也可能没有组而存在,在这种情况下,用GroupID 为0x0000来代替。值得特别注意的是:要避免情景ID冲突,并且没与组关联的情景相关的命令只支持单播,也就是说:它们不支持多播或组播。



资料搜索:
group是将一些节点分到一个群组中;
在节点分到一个群组之后,就可以在节点上建立scene;在建立scene的时候group ID是一个参数,所以必须先有group才能有scene。
ZCL中,scene有add,recall,remove等管理函数,比如你给一个节点发送一个命令让他add到一个scene中,你在scene的回调函数中就需要填一下存的是哪些个atrribute,然后在recall的回调函数中根据add时候的attribute来设置你被控节点的状态。add的时候把被控设备放置到你想要的状态,然后add,然后store,可以了。
恢复情境的时候调用recall啊。
store和recall的时候会有一个回调函数,回调函数中实现你真正地设备控制状态恢复。
ZigBee Home Automation Public Application Profile.pdf5.9.3 Commissioning DocumentationEnable Identify ModeSets the device in Identify mode for 60 seconds. This is used for adding devices toa group or create a scene.Group NodesUsed to add devices to a group. This action sends the “Add group if Identifying”command. This adds all devices that are in “identify mode” to the group. Thegroup ID is picked by the implementer.Create SceneThis action creates a scene using devices present in a group.For example, by a button press a “store scene” command is sent. The store scenecommand should sent to a Group already existing in the network. The Group ID isup to the implementer to pick.

5.9.5 Group Messaging vs. Unicast MessagingIt is important to consider that groups make use of broadcast transmissions. Groupmessaging should only be used when a device needs to communicate with a groupof greater than 5. For groups of less than 5, standard binding and unicast messagesshould be employed. Also, there is no acknowledgement service for groupmessages, because they are broadcast. Unicast messaging shall be used if a devicerequires APS acknowledgments.The procedures for group commissioning described above can also be used tocreate one-to-one bindings for unicast messaging with little or no modification.When these procedures are utilized, the decision to create a group or not can bemade by the application based on a local device policy. If a device is being boundto only 2 or 3 other devices, a unicast binding entry can be created for each target,and three unicasts will be sent instead of a group broadcast. When the destinationis a large number of devices, a group binding entry should be created. This makesgroup vs. unicast messaging transparent to the user.

Home_Automation_Profile_for_public_Download.pdf
Table 7.4

Group Nodes (Add Group If Identify)If this feature is supported the device must provide a way for the user to send an“Add Group if Identifying Request”.Create Scene (Store Scene)The device must provide a way for the user to send a Store Scene request.

Compile Options
The ZCL compile options are defined in the ZCL configuration file f8wZCL.cfg, which is located in theToolsfolder of the Z-Stack installation, along with other configuration files. Thef8wZCL.cfgfile is used by all projects that include the ZCL (i.e., all Home Automation projects). Therefore, any change made to this file will affect all HA projects. Compile options for other profiles, such as Smart Energy[5], can be found in their API documents. If needed, you can create a private version of thef8wZCL.cfgfile and modify your project to use the new version. The ZCL supported compile options and their definitions are listed in the following table:
ZCL_GROUPS
Enable the following commands:
1) Add Group
2) View Group
3) Get Group Membership
4) Remove Group
5) Remove All Groups
6) Add Group If Identifying
7) Add Group Response
8) View Group Response
9) Get Group Membership Response
10) Remove Group Response
ZCL_SCENES
Enable the following commands:
1) Add Scene
2) View Scene
3) Remove Group
4) Remove All Groups
5) Store Scene
6) Recall Scene
7) Get Scene Membership
8) Add Scene Response
9) View Scene Response
10) Remove Scene Response
11) Remove All Scenes Response
12) Store Scene Response
13) Get Scene Membership Response
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。