You can develop Python applications with any text editor or Python IDE and deploy them manually to the XBee Hive for Wi-SUN device.

But for a more streamlined workflow, Digi provides the Digi XBee PyCharm IDE plugin. This plugin integrates seamlessly with XBee Hive for Wi-SUN devices, allowing you to create new Python projects or import existing examples. And, once your application is ready, it lets you build and deploy it to the target device with a single click.

This section explains how to create a new project, import an existing sample and launch any application on the XBee Hive for Wi-SUN using the Digi XBee PyCharm IDE plugin.

For more information about the Digi XBee PyCharm IDE plugin, refer to the Digi XBee PyCharm IDE Plugin User Guide.

1. Launch the Digi XBee PyCharm IDE plugin

The first step in developing an application is to open the IDE with all the tools needed to streamline and simplify both development and deployment.

If you don’t have PyCharm or the Digi XBee PyCharm IDE plugin installed, follow the steps below.

Follow these steps to install PyCharm and the Digi XBee PyCharm IDE plugin:

  1. Download and install the latest version of PyCharm Community Edition from the PyCharm download page.

  2. Execute PyCharm.

  3. Go to the Plugins window by doing one of the following:

    • On the Welcome screen select Plugins.

    • Or, from the main menu, select File > Settings, and then click Plugins.

  4. In the Marketplace search box, type Digi XBee. The Digi XBee plugin should appear and selected by default.

  5. Click Install.

  6. When finished, click Restart IDE to complete the plugin installation.

After completing the installation, keep PyCharm open. You’ll use it throughout the rest of this process.

2. Create your project

Once PyCharm and the plugin are ready, you can start working on a new project. You can either:

Both options are supported directly within PyCharm using the Digi XBee plugin.

Import a Digi sample

Digi offers a wide variety of working examples that cover many common use cases to work with your XBee Hive for Wi-SUN devices. The Digi XBee PyCharm IDE plugin allows you to clone any of these examples from GitHub. These examples are pre-configured to run on XBee Hive for Wi-SUN and are a great starting point for testing or extending existing functionality.

To import a sample:

  1. Open the Import Digi Sample wizard dialog. You have 2 ways to do it:

    • On the Welcome screen, click New Digi Project and select Import Digi Sample on the modal dialog that appears.

    • Or, from the main menu, choose File > Import Digi Sample Project.

  2. In the wizard dialog, select the XBee Gateways category and click Next. The platform list appears.

  3. Select the Digi XBee Hive for Wi-SUN platform and click Next. The samples list is displayed.

  4. Select the desired sample project. When you click on a sample, the right-side pane displays a description for such sample. Use this as a helper to select the right sample for you.

  5. Once the sample is selected, click Next. The project configuration view appears.

  6. Specify the project location and Python interpreter, then click Create. PyCharm imports the sample and opens its main.py and README.md files.

Create an empty project

You can also start a project from scratch using Digi’s PyCharm plugin to simplify the setup.

To create a new project:

  1. Open the New Digi Project wizard dialog. You have 2 ways to do it:

    • On the Welcome screen, click New Digi Project and select Create Digi Project on the modal dialog that appears.

    • Or, from the main menu, choose File > New Digi Project.

  2. In the wizard dialog, select the XBee Gateways category and click Next. The platform list appears.

  3. Select the Digi XBee Hive for Wi-SUN platform and click Next. The available libraries list is displayed.

  4. If your project requires libraries, select them to be imported and click Next. The project configuration view appears.

  5. Specify the project location and Python interpreter, then click Create. PyCharm creates a new project and opens main.py, ready for you to start coding.

3. Build and launch your application

After you finish coding your application, you can build and launch it on your XBee Hive for Wi-SUN device directly from PyCharm.

As PyCharm first connects to the device where the application has to be deployed, you need to ensure that the device is discoverable. Once done, you do not have to repeat this process again:

A XBee Hive for Wi-SUN must be configured correctly before it can be discovered. Follow these steps to allow the Digi XBee Python PyCharm plugin to detect your XBee Hive for Wi-SUN:

  1. Ensure your XBee Hive for Wi-SUN device is mains powered and connected to internet over Ethernet as part of the LAN of your PC. The factory Setup IP address is 192.168.2.1.

  2. Log into the XBee Hive for Wi-SUN WebUI as a user with full admin access rights. The default user name is admin and the default password is the unique password printed on the label packaged with your device.

  3. Go to the Configuration window and, on the menu, click System.

  4. Under Configuration, click Device Configuration. The Configuration window displays.

  5. Enable service discovery (mDNS):

    1. Click Services > Service Discovery (mDNS).

    2. Enable the mDNS service.

      For more information, see TODO: Enable service discovery (mDNS).
  6. Configure SSH access:

    1. Click Services > SSH.

    2. Click Enable

  7. Enable shell access:

    1. Click Authentication > Groups > admin.

    2. Click the Interactive shell access option.

    3. If this option is not displayed, see TODO: Disable shell access.

  8. Click Apply to save the configuration and apply the changes. The Apply button is located at the top of the WebUI page. You may need to scroll to the top of the page to locate it.

To build and run:

  1. In the PyCharm top toolbar, click the Run button (green triangle). A dialog appears prompting you to select the target device.

  2. Click OK. The Digi Device Selector dialog opens.

  3. Choose LAN XBee Gateways to discover the XBee Hive for Wi-SUN device in the LAN and click Next.

  4. Select your XBee Hive for Wi-SUN and click OK.

  5. Wait for the Python application to be automatically transferred and executed on your XBee Hive for Wi-SUN device.

  6. The application is transferred and executed on the XBee Hive for Wi-SUN device. The Digi SSH console view displays the output of the application.

4. Next steps

To continue building your knowledge and applications using Python with XBee Hive for Wi-SUN, explore the ready-to-use examples available through the Digi XBee PyCharm IDE Plugin. These examples are directly importable and demonstrate, among other things, how to:

  • Perform regular device configuration tasks or manage runtime behavior.

  • Process and filter data at the edge before sending it to the cloud.

  • Interact with devices in the network for local control or monitoring.

  • Serve as a bridge between XBee devices and external systems or APIs.

  • Build richer device applications by extending the examples with custom logic.

To get started, see Digi XBee Pycharm IDE plugin.

Develop a Python application with other tools

If you prefer not to use the Digi XBee PyCharm IDE plugin, you can still manually develop and deploy Python applications following the steps below:

  1. Write your Python application using your preferred Python IDE or text editor.

  2. Transfer the application and required libraries to an existing folder in /etc/config/scripts of the XBee Hive for Wi-SUN device’s file system using a remote file copy mechanism like scp.

  3. Open the Terminal view of your device in XBee Studio and connect it.

  4. Navigate to the location of your script.

  5. Run the script using python and passing all the arguments it requires. The Python application starts and the Terminal within XBee Studio displays its output.

In addition to manually launching your application, you can configure the XBee Hive for Wi-SUN device to run your applications automatically. Refer to this page for information on how to do it.