Ubisys Smart Home Application Zigbee Direct Setup


1. Overview

Zigbee Direct has three distinct device roles: ZVD, ZDD, and Zigbee Device.

  • The ZVD is a device that runs the Zigbee stack, and the BLE stack only. The ZVD can be used to control clusters on the ZDD as well as the Zigbee Device.
  • The Zigbee Device runs the Zigbee stack, and the 802.15.4 stack.
  • The ZDD is a ZD device that runs the Zigbee stack, the 802.15.4 MAC stack, and the BLE stack (coexistence).



Hence, direct communication between a ZVD and Zigbee Device is not possible. The ZDD must be present to route messages from the ZVD to the Zigbee Device.

The Ubisys Smart Home Application for iPhone functions as a Zigbee virtual device (ZVD) and may be used to control Zigbee radio devices from a mobile device. In configurations that include both Zigbee direct devices (ZDD) and standard Zigbee devices, the ZDD acts as a bridge to relay commands from your phone to Zigbee devices without Bluetooth capabilities.

This demo shows an STM32WBA55-NUCLEO (or STM32WBA65-NUCLEO) Zigbee direct device (ZDD - ZigbeeDirect_OnOff Application) using the Ubisys ZVD iOS phone application to control a Zigbee device (ZD - ZigbeeDirect_OnOff_Server_Router_Identify Application) via Bluetooth. The ZVD joins the ZDD Zigbee network and controls the Zigbee device by sending On and Off commands or Level control commands.

Summary of Demo 1: The ZDD is the coordinator. Demo 2 topology: ZDD and ZD and then adding the ZVD.

The demo 1 can be used to demonstrate Zigbee interoperability with Philips hue 1100 bulb or IKEA tradfri bulb.

Summary of Demo 2: The ZVD is acting as the coordinator. Minimal topology: ZVD and ZDD.

In current Cube release STM32WBA version v1.6.1, no ZED application is provided and the ZR application provided in bellow figure is the ZD - ZigbeeDirect_OnOff_Server_Router_Identify Application.

ZigbeeDirect_OnOff Zigbee application is the ZDD and is the coordinator with v1.7 STM32WBA cube release.

2. Setup

In this section, we will:

  • Download and install the Ubisys Smart Home application on an iPhone.
  • Build and flash the zdd ZigbeeDirect_OnOff Zigbee application to the NUCLEO-WBAxx.
  • Retrieve the line (on teraterm or termite) public Bluetooth address of the NUCLEO-WBAxx for use with a BLE sniffing solution.

2.1. iPhone application installation

To install the Ubisys Smart Home application on the iPhone to be used as the ZVD:

  1. Open the App Store app on your iPhone.
  2. Search "Ubisys Smart Home" in the App Store.
  3. Install the app.

2.2. STM32WBAxx ZDD configuration

NUCLEO-WBA55CG and NUCLEO-WBA65RI have the same zdd applications in the directory BLE_Zigbee.

To configure the STM32WBA55/65 as a ZDD:

  1. Build the ZDD BLE_Zigbee/ZigbeeDirect_OnOff Zigbee application in either IAR, Keil or STM32CubeIDE.
  2. Download the output binary to the NUCLEO-WBA55CG/WBA65RI using an IDE or STM32CubeProgrammer.

2.3. Retrieve public Bluetooth® address

To retrieve the public Bluetooth address of the NUCLEO-WBA55CG/WBA65RI:

  1. Connect the NUCLEO-WBA55CG/WBA65RI to a computer via USB-serial.
  2. Open a serial terminal.
  3. Power on the NUCLEO-WBA55CG/WBA65RI.
  4. Record the public Bluetooth address shown in the debug output.
  5. Use this address to configure your Bluetooth sniffing solution.

When you connect the NUCLEO-WBA55CG/WBA65RI to a computer via USB-serial, you will have access to a limited command line. Type help to get a listing of the commands available and their descriptions.

3. Demo 1 Procedure

In this section, we will:

  • Check (or Modify) the ZDD ZigbeeDirect_OnOff application to have a ZC_ZDD
  • Start the ZDD ZigbeeDirect_OnOff application on the NUCLEO-WBA55CG/WBA65RI.
  • Add a ZR Zigbee Device ZigbeeDirect_OnOff_Server_Router_Identify to the ZDD’s Zigbee network.
  • Connect the iPhone to the STM32WBAxx ZDD.
  • Add two components to the ubisys Smart Home application.
  • Control the Zigbee devices using the iPhone.

3.1. Check or Modify the ZDD application

The ZDD ZigbeeDirect_OnOff application might need some modification to form a network. Here are the few lines (with define ZDD_IS_ZC) in app_zigbee_endpoint.c that transform the ZDD from Router to Coordinator:

#define ZDD_IS_ZC
 
void APP_ZIGBEE_ApplicationInit(void) {
   LOG_INFO_APP( "ZIGBEE Application Init" );
   /* Initialization of the Zigbee stack */
   APP_ZIGBEE_Init();
   #ifdef ZDD_IS_ZC
     /* Configure Application Form/Join parameters : Startup, Persistence and Start */
   stZigbeeAppInfo.eStartupControl = ZbStartTypeForm ;
   stZigbeeAppInfo.bPersistNotification = false;
     /* USER CODE BEGIN APP_ZIGBEE_ApplicationInit */
   stZigbeeAppInfo.bNwkStartup = true;
   #else
    /* Configure Application Form/Join parameters : Startup, Persistence and Start */
   stZigbeeAppInfo.eStartupControl = ZbStartTypeJoin;
   stZigbeeAppInfo.bPersistNotification = false;
    /* USER CODE BEGIN APP_ZIGBEE_ApplicationInit */
   stZigbeeAppInfo.bNwkStartup = false;
   #endif /* ZVD_IS_ZC */ 

3.2. Start the ZDD and ZD application

To start the ZDD application on the NUCLEO-WBA55CG/WBA65RI:

  1. Power on the NUCLEO-WBA55CG/WBA65RI with ZigbeeDirect_OnOff application.
  2. The ZDD application starts and begins sending Bluetooth® Low Energy (BLE) advertisement messages.
  3. Power on the second NUCLEO-WBA55CG/WBA65RI with ZigbeeDirect_OnOff_Server_Router_Identify application. Or optionally, after factory reset of the Philips hue 1100 bulb or IKEA tradfri bulb, instead of the second nucleo, power on the Philips hue 1100 bulb or IKEA tradfri bulb.
  4. After few seconds, both boards must have blue LED, indicating they have formed a network.

3.3. Connect the iPhone to the STM32WBA55 ZDD

To connect the Ubisys Smart Home app to the ZDD:

  1. Open the Ubisys Smart Home app on your iPhone.
  2. A screen displaying "Connect Gateway…" appears.
    • Press the "x" in the top left corner to skip this step.
  3. A screen displaying "Facilities" appears.
    • If the Facilities screen does not automatically appear, access the screen from the main menu of the app by selecting the menu path: Settings > Facilities.
  4. Press the edit symbol in the top right.
  5. Select "New Facility."
  6. Select "Create via Bluetooth."
  7. Use the three dots to select the advertising ZDD.
    • If the ZDD appears in the Facilities screen with the message "Does not permit joining," enter the "pjoin" command on the ZDD to re-enable joining.
Connectivity ZigbeeDirectConnectionwithiphone.png
  1. In the opened notification, confirm that the ZDD has the expected Bluetooth® address and press OK.
Connectivity ZigbeeDirectConnectionwithiphone1.png
  1. This will start the connection process. During this process, the ZVD also commissions the ZDD to form a Zigbee network. Wait for the connection process to finish.
Connectivity ZigbeeDirect waitconnection.png
  1. When the Discover Devices notification appears, select "Yes, the entire network."
Connectivity ZigbeeDirect step10.png

The app begins searching for components. The process completes within a few seconds. At this point, an entry for your ZDD appears in the Facility menu along with an entry in the components menu under the menu path:

Configuration > Basic Configuration > Components

3.4. Connect the STM32WBAxx Zigbee Device to the STM32WBAxx ZDD

To connect the STM32WBAxx Zigbee Device Zigbee_OnOff_Server_Router to the STM32WBAxx ZDD :

  1. Access the Basic Configuration menu by navigating to the menu path:

    Configuration > Basic Configuration

  2. Select "Open for new devices".
Connectivity ZigbeeDirect openfornewdevice.png
  1. Navigate to the menu path:

Configuration > Basic Configuration > Components

  1. Swipe down to refresh the page.
    • There may be a delay of a minute or so between the time Swipe down and when it appears in the components menu.
  2. Select the device with the correct Bluetooth® address from the components menu.

3.5. Managing components

The Ubisys app uses components to link UI controls to device functions. Functionalities of Zigbee devices are addressed via endpoints. Endpoints are displayed in the app with a preceding hashtag (#). The provided application will have an OnOff cluster on endpoint 1. In this section, we will:

  1. View the components on your device
  2. Edit the components name
  3. Create a room
  4. Add the components to the room

To manage components in the Ubisys app:

  1. Access the components menu by navigating to the menu path:

    Configuration > Basic Configuration > Components.

  2. If you do not see your devices as a component, refresh the components menu by swiping down.
    • There may be a delay of a minute or so between the time a new device joins the network and when it appears in the components menu.
  3. Select the device with the correct Bluetooth® address from the components menu.
Connectivity IMG 0062.png
  1. Select the edit symbol and change the name of the device to "Light Switch 1 ".
Connectivity ZigbeeDirect light switch 1.png
  1. Select the edit symbol and change the name of the device to "Light Switch 2 ".
Connectivity IMG 0061.png
  1. Navigate to the menu path:
  2. Configuration > Basic Configuration > Rooms

  3. Select the edit symbol.
  4. Select the plus symbol located next to "New Room".
  5. Name the room and select the check mark.
  6. Connectivity ZigbeeDirect Managing Components8.png
  7. Select the newly created room.
  8. Navigate to the menu path:
  9. Edit > Add device

  10. Select the light switch components (OnOff server) on the expected endpoint.
  11. Select the check mark.
  12. Select the check mark again to finish adding devices to the room.

3.6. Sending On and Off Commands

To send On and Off commands to the Zigbee device:

  1. Navigate to the menu path:

    Building Control > Name of room>

  2. Circle buttons will appear to toggle the lights switch on and off.
Connectivity ZigbeeDirect lights off.png

With this process complete, the circle buttons now signifies when the cluster is turned on by changing color to green.

3.7. Sending On and Off commands or level control commands to Philips or Ikea bulbs

In this topology:

Connectivity Ubisys Smart Home Application Zigbee Direct Setup WITH ZD Philips or Tradfri.png

Once the setup is complete, the display will be the following:

Connectivity Ubisys Smart Home Application Zigbee Direct Setup 1746024973550.png

3.8. Disconnecting the ZVD from the ZDD

To disconnect the ZVD from the ZDD and the Zigbee device:

  1. Navigate to the menu path:

    Settings > Facilities > Edit

  2. Select the red minus symbol next to the device
  3. Confirm by selecting "delete"

4. Demo 2 Procedure

In this section, we will:

  • Start the ZDD BLE_Zigbee/ZigbeeDirect_OnOff application on the NUCLEO-WBA55CG/WBA65RI.
  • Connect the iPhone to the STM32WBA55/WBA65 ZDD.
  • Add a Zigbee device to the ZDD’s Zigbee network.
  • Configuring and add a component to the ubisys Smart Home application.
  • Control the ZDD using the iPhone.

4.1. Start the ZDD application

To start the ZDD application on the NUCLEO-WBA55CG/WBA65RI:

  1. Power on the NUCLEO-WBA55CG/WBA65RI.
  2. The ZDD application starts and begins sending Bluetooth® Low Energy (BLE) advertisement messages.

4.2. Connect the iPhone to the STM32WBAxx ZDD

To connect the Ubisys Smart Home app to the ZDD:

  1. Open the Ubisys Smart Home app on your iPhone.
  2. A screen displaying "Connect Gateway…" appears.
    • Press the "x" in the top left corner to skip this step.
  3. A screen displaying "Facilities" appears.
    • If the Facilities screen does not automatically appear, access the screen from the main menu of the app by selecting the menu path: Settings > Facilities.
  4. Press the edit symbol in the top right.
  5. Select "New Facility."
  6. Select "Create via Bluetooth..."
  7. Use the three dots to select the advertising ZDD.
    • If the ZDD appears in the Facilities screen with the message "Does not permit joining," enter the "pjoin" command on the ZDD to re-enable joining or press push button SW1 on the ZDD to re-enable joining.
Connectivity ZigbeeDirectConnectionwithiphone.png
  1. In the notification, confirm that the ZDD has the expected Bluetooth® address and press OK.
Connectivity ZigbeeDirectConnectionwithiphone1.png
  1. This will start the connection process. During this process, the ZVD also commissions the ZDD to form a Zigbee network. Wait for the connection process to finish.
Connectivity ZigbeeDirect waitconnection.png
  1. When the Discover Devices notification appears, select "Yes, just the device."
Connectivity ZigbeeDirect step10.png

The app begins searching for components. The process completes within a few seconds. At this point, an entry for your ZDD appears in the Facility menu along with an entry in the components menu under the menu path:

Configuration > Basic Configuration > Components

4.3. Managing components

The Ubisys app uses components to link UI controls to device functions. Functionalities of Zigbee devices are addressed via endpoints. Endpoints are displayed in the app with a preceding hashtag (#). The provided application will have an OnOff cluster on endpoint 1. In this section, we will:

  1. View the components on your device
  2. Edit the component name
  3. Create a room
  4. Add the component to the room

To manage components in the Ubisys app:

  1. Access the components menu by navigating to the menu path:

    Configuration > Basic Configuration > Components.

  2. If you do not see your device as a component, refresh the components menu by swiping down.
    • There may be a delay of a minute or so between the time a new device joins the network and when it appears in the components menu.
  3. Select the device with the correct Bluetooth® address from the components menu.
Connectivity ZigbeeDirect Managing Components.png
  1. Select the edit symbol and change the name of the device to "Light Switch".
Connectivity ZigbeeDirect Managing Components4.png
  1. Navigate to the menu path:
  2. Configuration > Basic Configuration > Rooms

  3. Select the edit symbol.
  4. Select the plus symbol located next to "New Room".
  5. Name the room and select the check mark.
  6. Connectivity ZigbeeDirect Managing Components8.png
  7. Select the newly created room.
  8. Navigate to the menu path:
  9. Edit > Add device

  10. Select the light switch component (OnOff server) on the expected endpoint.
  11. Select the check mark.
  12. Select the check mark again to finish adding devices to the room.

4.4. Sending On and Off Commands

To send On and Off commands to the Zigbee device:

  1. Navigate to the menu path:

    Building Control > <Name of room>

  2. A circle button will appear to toggle the light switch on and off.
Connectivity ZigbeeDirect Sending On and Off Commands.png

With this process complete, the circle button now signifies when the cluster is turned on by changing color to green.

4.5. Disconnecting the ZVD from the ZDD

To disconnect the ZVD from the ZDD:

  1. Navigate to the menu path:

    Settings > Facilities > Edit

  2. Select the red minus symbol next to the device
  3. Confirm by selecting "delete"