Time Synchronization in Devices
An important aspect in a Zigbee network, whose controller is internet enabled, is the synchronization of time between the controller and all other devices on the network.
Some router and end devices require the controller( or other router device ) to have a Time server - end cluster. If one is not found the device will not join the network.
The information provided below gives a high-level overview of the Time client/server - end clusters and synchronization between devices.
Cluster Overview
The Time Cluster (0x000a) provides a basic interface to a real-time clock. The clock time may be read and also written, in order to synchronize the clock (as close as practical) to a time standard. The cluster also includes basic functionality for local time zone and daylight saving time.
The Time server-end cluster contains the attributes used to store the time information. These values are read/write and devices requiring the attribute values must read the values directly(no specific commands required).
Synchronization
Devices requiring a valid Time server-end Cluster, will, during the device commissioning phase, broadcast a Match Descriptor Requester for the Time server-end Cluster. Once found, the device can then read any time server attributes it requires.
However, if a valid Time server is not found, RapidConnect enabled devices have a built in retry mechanism to try and synchronize time values.
The retry mechanism operates as follows:
If a valid time server cluster is not found, the device will retry the query after a certain period of time. A time server not found condition is true if the following are true:
- No Match Descriptor Response was returned from a Time server or
- A Match Descriptor Response was returned but the Time Status attribute doesn't report that it's a valid Time server.
If not found, the device will try again in 24~26 hours. A Time Sync also occurs every 12~13 hours if a valid Time server was found.
Additional Notes
The TimeStatus attribute is one of the more important attributes in the cluster and defines the accuracy of the time reading.
Bit Values of the TimeStatus Attribute
Attribute Bit Number | Meaning | Values |
---|---|---|
0 | Master | Master clock/0 - not master clock |
1 | Synchronized | Synchronized/0 - not synchronized |
2 | MasterZoneDst | Master for Time Zone and DST/0 - not master for Time Zone and DST |
3 | Superseding | Tme synchronization SHOULD be superseded/0 - time synchronization SHOULD not be superseded |
1The Master and Synchronized bits together provide information on how closely the Time attribute conforms to the time standard.
The Master bit specifies whether the real time clock corresponding to the Time attribute is internally set to the time standard. This bit is not writeable – if a value is written to the TimeStatus attribute, this bit does not change.
The Synchronized bit specifies whether Time has been set over the ZigBee network to synchronize it (as close as MAY be practical) to the time standard (see 3.12.1). This bit must be explicitly written to indicate this – i.e., it is not set automatically on writing to the Time attribute. If the Master bit is 1, the value of this bit is 0.
If both the Master and Synchronized bits are 0, the real time clock has no defined relationship to the time standard (e.g., it MAY record the number of seconds since the device was initialized).
The MasterZoneDst bit specifies whether the TimeZone, DstStart, DstEnd and DstShift attributes are set internally to correct values for the location of the clock. If not, these attributes need to be set over the network. This bit is not writeable – if a value is written to the TimeStatus attribute, this bit does not change.
Devices SHALL synchronize to a Time server with the highest rank according to the following rules, listed in order of precedence:
- A server with the Superseding bit set SHALL be chosen over a server without the bit set.
- A server with the Master bit SHALL be chosen over a server without the bit set.
- The server with the lower short address SHALL be chosen (note that this means a coordinator with the Superseding and Master bit set will always be chosen as the network time server).
- A Time server with neither the Master nor Synchronized bits set SHOULD not be chosen as the network time server.
- Zigbee Alliance (2015, 03, 18). Zigbee Cluster Library Specification - R5.
*Permission is granted to members of the ZigBee Alliance to reproduce this document for their own use or the use of other
ZigBee Alliance members only, provided this notice is included. All other rights reserved. Duplication for sale, or for commercial
or for-profit use is strictly prohibited without the prior written consent of the ZigBee Alliance.
Legal Notices
Copyright © 2020 MMB Networks, Inc. All rights reserved.
Confidential materials prepared and delivered by MMB Networks for receipt and review only by any partner subject to a valid and enforceable MMB Networks confidentiality agreement. Any receipt, review, or misuse of any of the content exchanged hereunder by any party not a party to this confidential exchange shall be subject to any and all rights available under the law. All rights, title and interest to the materials shall remain with MMB Networks.
Any suggestions provided to MMB Networks with respect to MMB Networks' products or services shall be collectively deemed “Feedback.” You, on behalf of yourself, or if you are providing Feedback on behalf of your employer or another entity, represent and warrant that you have full legal authority to bind such entity to these terms, agree to grant and hereby grant to MMB Networks a nonexclusive, perpetual, irrevocable, royalty free, worldwide license to use and otherwise exploit such Feedback within any MMB Networks products and services.