Time vs. Clock vs. Time Parameters Command Classes Explained

Introduction

Door locks, thermostats and other Z-Wave devices often need to know at least the time and day of the week. In many cases they need to know the full date and time to enable a lock User Code when a renters code is valid or set the thermostat into energy save mode. These devices need a way to determine the current date and time to within a few seconds of accuracy.

Z-Wave provides three different command classes (CC) for getting various parts of the date/time. Time Command Class is mandatory for all Gateways. Unfortunately, not all gateways support it yet, so most devices need to support one of the other command classes for use with older hubs. The question then is how is a device supposed to get the current date/time so the schedule can operate properly?

Time CC – Recommended

Time command class is described in SDS13782 (Z-Wave Management Command Class Specification). Time CC is mandatory for all Z-Wave Plus Gateways and thus is the recommended method for a device to set its clock to the current local date and time. Time CC Version 2 adds time zones and daylight savings time support if desired however V1 provides the necessary data in most cases.

The Z-Wave specification recommends having an association group to identify the time server node however the Gateway is expected to have an accurate time reference so using the Lifeline is acceptable.

The Time CC does NOT have a date/time SET command. Thus, the hub cannot set the date/time and instead must wait for the device to GET it. When a device is included in a network, it must send a Time GET command within the first few minutes to accurately set its internal clock. The device should then periodically send a Time GET to ensure the internal clock remains accurate to the local time. Note that for certification purposes a device CONTROLs Time CC, it does not SUPPORT it. The Hub is required to SUPPORT Time CC.

Time Parameters CC – Optional

The Time Parameters command can SET/GET/REPORT the year, month, day, hour, minute & second of the UTC time. However, it does not set the time zone which must be done via the Time CC V2. Thus, Time Parameters CC relies on the hub to send the current UTC time but the device can also send a GET and adjust its internal clock to match the one from the hub. However, this requires support on the hub software which is not mandatory so not all hubs will be able to provide the current date/time.

Clock CC – NOT Recommended

Clock command class is sent by a Hub and can set the local weekday and time. Thus, it only supports a 7-day schedule since it cannot set the date, just the day of the week. Typically, the Hub would send a Clock Set as part of inclusion in the network. Since the clock on the device will drift, the device must periodically send a Clock Get to the Hub and to maintain time accurately. This method is NOT recommended. However, on some old hubs this is the only method available.

Recommended Time Setting Algorithm

  1. Wait for Inclusion into a Z-Wave Network
  2. Wait for Security negotiation to complete
  3. Send a Time CC DATE GET
  4. Wait for a Time CC DATE REPORT for ~30s
  5. If DATE REPORT arrives, Send a Time CC TIME GET and wait for ~30s
    1. if the Time REPORT arrives then the date/time is now set and use Time CC for future clock adjustments
    1. Exit the search for the local time
  6. If Time CC DATE REPORT times out:
    1. Retry 2 more times with random delay of a few minutes between each retry
  7. During steps 3-6, If a Time Parameters CC SET or a Clock CC REPORT is received, use those to update the date/time but if a Time CC report arrives use Time CC
  8. Send a Clock CC GET
    1. If a REPORT arrives within ~30s then use Clock CC GET to update the date/time
  9. If CLOCK fails
  10. Send Time Parameters CC GET to get the current date/time
  11. If those fail, there is no source for the current date/time, disable all scheduling features

Depending on the accuracy of the local clock circuitry, the functioning time setting command class should be used to update the local clock at a sufficient rate to match the desired settings. Typically, this would be once per day assuming a 100ppm or better 32Khz crystal is used for the 700 series low frequency external crystal oscillator (LFXCO).

Conclusion

End Devices should send a Time CC Date/Time GET shortly after inclusion in a Z-Wave network and then periodically send Date/Time GETs based on the accuracy of the real-time clock circuitry. Updating at 3:10am ensures the clock will be accurate to daylight savings time should be sufficient for a low-cost 32kHz crystal. The algorithm above works for just about any hub that has at least minimal support for time keeping.

Z-Wave Challenges in MDUs and How to Resolve Them

Deploying a robust Z-Wave network in MDUs (like apartment buildings or hotels) can be challenging unless you follow a few basic rules.
The most common problem in MDU deployment is that many installers fail to take advantage of Z-Wave’s number one technical advantage – the mesh network. Every always-on (wall powered) Z-Wave device adds a node to the mesh. But battery powered devices like door locks, sensors and many thermostats do NOT add nodes to the mesh – they merely benefit from other devices on the mesh network. A system where there is one Z-Wave hub and a door lock in each dwelling unit will result in a poorly performing system because there is no mesh! To build a reliable mesh, every device in the network needs at least two routes between the hub and every device on the network. This means you need at least one Z-Wave repeater or lamp module in every network.
An MDU can easily have dozens or even hundreds of units all within Z-Wave range of each other. If each unit has just a single Z-Wave hub and a door lock, then each unit causes interference with every other unit resulting in a cacophony of Z-Wave traffic. A better solution is to have one hub serve 5 or even 10 units with each unit having at least one always-on device within it to provide a good “mesh” node to access the battery powered devices. Always-on devices in adjacent units help provide routing pathways to improve the robustness of the network. The installer needs the proper tools to evaluate the best location for these always-on devices to ensure a high-quality mesh network with plenty of alternate routes.
Another challenge in MDUs is that things are always changing. An owner might install a mirror (which is a metal plate on glass) or a metal appliance that significantly alters the Z-Wave quality within the unit. Even though the mirror or appliance is not in between the hub and the door lock does not mean that it won’t cause connectivity problems. The solution to this issue lies again with the mesh network and having alternate routes. Since things are always changing, the hub needs to have a policy to “heal” the network occasionally to adjust to the changes in the environment.
If some door locks seem to have short battery life then you might be suffering from limitations in older, pre-500 series Z-Wave devices. Early generations of Z-Wave would wake up battery powered devices like door locks using only their NodeID to request which node to wake up. This works fine in single family homes since every node on the network has a different NodeID, but in an MDU with multiple adjacent Z-Wave networks, if the door lock in each unit is NodeID=2, then every hub will wake up every door lock in the building any time a unit needs to check on the battery level of any door lock. The solution is to ensure each adjacent installation has a different NodeID for door locks or battery powered nodes. Thus, apartment 101 will have the door lock as NodeID=02, apartment 102 will have the door lock as NodeID=03, and so on. The latest generation of Z-Wave solves this problem so as these newer locks come on the market this issue will disappear.

A few quick rules for deploying Z-Wave in MDUs:

  1. Always build a Z-Wave mesh
  2. Install fewer hubs
  3. Use tools like IMA to validate mesh networks
  4. Don’t build the same network in every unit
  5. Network must be flexible due to changing environments