iot-home-automation

Testing ZigBee based Home Automation System

IoT (Internet of things) is one of the well-known technologies nowadays. From the past few years, we have been hearing a lot about IoT technology, its protocols and have seen different IoT products/solutions which have proven the concept. As per the market experts and research reports, IoT products will cater to different fields/domains, as it is expected to connect 28 billion devices by the year 2022, 75 billion by 2025 and 500 billion by 2030.

IoT devices are built using different protocols such as RFID, BLE, Zigbee, Wi-Fi, MQTT, LORA, ZWave, etc. In an IoT ecosystem, different devices built on different protocols are expected to communicate with each other. This is where IoT testing plays a key role.

IoT Devices communicate over a protocol, knowledge of which will play a key role in understanding and testing the system. In this blog post, we will talk about ‘Testing of ZigBee Home automation device’s as there are many ZigBee products in the markets which are from same/different manufacturers and they in-turn should work together as expected.

Before we begin, let’s have a high-level understanding of the ZigBee protocol.

ZigBee is a standards-based wireless technology, widely used in Home automation systems. It is developed on top of IEEE protocol 802.15.4. ZigBee is highly robust, reliable and well known for its mesh networking concept for communication between devices.

Currently, ZigBee 3.0 is the latest version (as of Dec 2019) that’s a unification of ZigBee pro which made developers create products and services that could interoperate seamlessly with the widest variety of everyday devices.

The important specification to look into in ZigBee protocol is its Cluster library. Clusters are a set of Attributes and commands responsible for data communication between two devices. One cluster can have one or more attributes that physically execute commands. In simple, clusters define what a device can do.

 

ZigBee – Home Automation Devices and Clusters:

The below picture shows home automation ZigBee devices with their respective server and client clusters. Please zoom in to understand. Note that the picture shows only a few devices which are supported in Home automation, other HA devices and common clusters among all devices are not mentioned.

 

ZigBee Home Automation Devices and ClustersZigbee HA Devices and clusters
(Click on Image to Zoom)

 

How ZigBee Devices Communicate:

Generally, devices communicate through the exchange of their respective cluster commands. The below picture shows how two devices in a network identify, communicate, and exchange information with each other.

How ZigBee Devices Communicate

To understand the process let us take two devices, for example, Remote control, a generic device and a Colour dimmable Smart bulb which is a Lightning device in Home Automation. Once the devices are on the same ZigBee network the following are the sequence of steps will be observed when a remote interacts with the bulb

 

Steps:

  1. Remote control will send an identify query request (0x01) command to the smart bulb asking to identify itself.
  2. The smart bulb will respond to request using identify query response (0x00) command that allows the remote control to know the existence of the Smart bulb.
  3. After identification of devices is completed, the next step is to share a simple descriptor (simple descriptor contains the cluster information of particular target device supports, here target device is smart bulb). The remote control will request for simple descriptor (cluster information) of a smart bulb and the bulb will pass back with its cluster list. Please refer to the below image.

    clusters of smart bulb and remote controlCluster list of Colour dimmable bulb and remote control.

  4. Next, the remote control looks at the bulb clusters information, matches the common clusters it has and generates them as entries in the Binding table. Refer to the below picture,

smartbulb and remote control clusters informationBinding Table with respective cluster commands
(Click on Image to Zoom)

 

Deriving Test Cases:

The binding table outlines the possibilities of interaction between devices and could be the source to draw and device tests that can be conducted to test the communication between devices. The below image shows a few sample test cases written to demonstrate how functionality between two products (remote control and smart bulb) is tested.

sample test cases

Conclusion:

With the possibility of myriad test cases in the home automation system, the approach of deriving test cases via the binding table gives optimal test sets to be considered for testing. We could derive multiple other test cases with an increase in device count and communications within the HA system.

With the addition of devices specific to industry into home automation network like – Personal/health care, industrial plant monitoring, Telecom Appliances, Advance metering, etc. could add up to more interesting tests.

Apart from the above, considerations for Connectivity, interoperability, compatibility, security, integration, etc. are important for testing the Home automation system.

For more information, please contact us at sales@zenq.com