Skill Level: Intermediate

You will need some understanding on Z-Wave, MQTT and Node-RED.

The recipe provides a guide for connecting the Access-IoT gateway with a power switch device for management through your own Watson IoT platform.


An Access-IoT gateway for Z-Wave.
An existing account on IBM Bluemix (or create one following the recipe).
A few Z-wave approved devices (in this example a power switch is configured and connected to Watson IoT Platform).


  1. The Access-IoT gateway and related hardware

    The Access-IoT gateway and a Power Switch (From Everspring model AN158-2).

    The gateway is a state-of-the-art sturdy design from Access-IoT for close integration with IBM Watson IoT through MQTT.

    Access-IoT supports a vertical approach to IoT having built-in support for multiple communication protocols including Z-Wave, W-mBus, BLE all centered around MQTT enabled control from the Watson IoT Platform.

  2. Prepare the Bluemix environment

    1. Go to IBM Bluemix: https://console.ng.bluemix.net/

    2. Log in with your credentials or create a free account.

    Enter your Organization name and set a workspace (Test, Education etc.). In this example I use Access-Iot Develop as Organization and have created a space called Recipe.

    3. On frontpage Click Take advantage of Iot to start the IoT Boilerplate (can also be obtain from the Services menu).


    4. Enter an App name (I use Access-IoT gateway) Click Create.

    When it looks like this: RUNNING you’ re good to go (You now have Watson IoT Platform, a Cloudant database and a Node-RED environment ready-to-go).

  3. Setup Watson IoT Platform to control the gateway

    1. Click Connections and succesively Click your IoT service icon to setup a Device (the Watson IoT Platform association with the Access-IoT gateway). 

    2. Launch Bluemix Dashboard


    3. Click the Device icon

     and Click Add Device

    4. Add a new device (The Access-IoT gateway)

    ¬†–> ¬†¬†Click¬†Create device type

    (IMPORTANT: We set the gateway up as a Device – If you choose Gateway instead you will have to configure a lot more centrally (sensors and such) on the Watson IoT Platform which we do not recommend for this use-case).

    Enter Device name and description

     click Next

    click through the next screens and enter Device ID

     click Next + Next and enter a

    self-provided Security Token (REMEMBER THIS as you will need for configuring the connection from the gateway – I use tokentoken). Please note the general recommendation is to use an auto-generated token.

    click Next and Add

    Eventually a confirmation screen appears:

    This information is vital for the next steps.

    The device is now added to the Watson IoT platform and :

  4. Connect Access-IoT gateway to Watson IoT Platform

    Connect the Access-IoT gateway to power and LAN (use a cable). Obtain the IP address from network admin or by using e.g. the Fing app on the same network where the gateway is connected to. In this recipe I use IP address Рopen a browser tab and type your gateway IP-address.

    Admin and no pw is the default.

    1. Connect to the MQTT broker on Watson IoT

    Click MQTT Control and MQTT Configuration, Click Edit

    Click Enable + Clean Session ON. Enter organizationID.messaging.internetofthings.ibmcloud.com in the Broker Domain Name Рin my case 3u6q00.messaging.internetofthings.ibmcloud.com

    Client ID is d: for Device

    Organization ID: (eg. 3u6q00:)

    Device type: (eg. Access)

    Device ID (eg. Access-1)

    Click OK and Choose Save Configuration in the control pane.

    2. On IBM Watson IoT Platform your device should go online


    And show some connection information – IF NOT: Your Broker Domain info and connection strings will need to be revisited.

  5. Add the power switch device as a new Z-Wave node

    Logon to the gateway web-interface (Admin), Click Z-Wave Network Manager:

    Click Add Node and turn to the Power Switch:

    1. Plug the device in at close proximity (< 2 metres) of the Access-IoT gateway.

    2. Click the on/off button on the device 10 times (fast repetition).

    Watch Video

    3. When succesfully added the device shows up:

    (in my case the Node Id is 7 – this may differ as the figure is incremented from last known Node Id).

    4. Check the function. Click the Node and Binary Switch Settings.

    Toggle between On+SET and Off+SET – the device responds with a click and lit/unlit LED.

  6. Craft the first Node-RED script to control the Power Switch

    1. Extract all events from the Access-IoT gateway

    Select the Input ibmiot icon and drag it to the canvas. Double-Click it.

    Add a Debug (msg.payload) and wire the two nodes (dot-to-dot):

    Click Deploy and see the gateway change to green (connected).

    The Debug tab shows all incoming messages from the device Рvery convinient when tracking payloads and sensor activity. 

    2. Two switches

    Now setup a switch for On and one for Off. This requires Payloads….



    {"nodeID" : "7", "cmdClass" : "bswitch", "data" : "1", "action" : "set"}   | THIS TURNS THE POWER ON

    {"nodeID" : "7", "cmdClass" : "bswitch", "data" : "0", "action" : "set"} | THIS TURNS THE POWER OFF



    The Access-IoT gateway subscribes to a MQTT Topic built like:


    IMPORTANT!!! On Watson IoT any topic starts with iot-2/type then slash and Device type (Access) slash id slash Device id (Access-1) in this case we add /cmd/fmt/json for a command in json format.

    Watch out for your Node Id and assure the Topic to point to your device naming.

    Now add an Ibmiot out node:

    Assure Types and IDs.

    This small configuration leaves you with:

    Click the OFF and ON injects (on the little square) to see the light (provided a lamp is on) and hear the Power Switching sound.

  7. Add a database for data collection



    Add a Cloudant Out node (Important: The database is created on first Insert so no need to go through configuration work here BUT REMEMBER: database names must be in lower case (here I use Sensors).

    3. Wire it up nicely and Click Deploy

    Here I also added a Debug out for console display. 

    4. Play around with the switches – and enhance.

    CONGRATULATIONS – You have created connectivity and control!

  8. Reach out

    If you want to get started with an Access-IoT gateway you should email Henk van Ark hva@access-iot.com and you reach out to me on community and sbk@access-iot.com for discussions, ideas and troubleshooting. 

    All the best,

    S√łren B√¶k, Access-IoT, Copenhagen, Denmark

Join The Discussion