How to Integrate the Dusun Gateway to OpenHAB

This post describes the way to integrate the Dusun IoT gateway to OpenHAB platform in steps.

  1. Download OpenHAB from the link Download openHAB | openHAB
  2. Open the OpenHAB web client, enter the paper UI page

DM 20220701150420 008

  1. Pair one zigbee device with our gateway, as for an example, we used a socket to control switch on/off.

DM 20220701150420 009

  1. Enter the OpenHAB webpage and enter PAPER UI.

DM 20220701150420 010

  1. Choose Add-ons, BINDINGS and type in mqtt, and install.

DM 20220701150420 011

  1. Choose the MISC page and install MQTT Broker Moquet.

DM 20220701150420 012

  1. Choose the Then add the mqtt broker to the gateway, if you had the external broker, choose the MQTT Broker, in our sample we just use the embedded broker for installation. By default, it used the localhost as the host and port 1883.

DM 20220701150420 013

  1. Then create a Generic MQTT Thing by adding MQTT Binding – ADD MANUALLY – Generic MQTT Thing. Choose the bridge as the MQTT Broker we create just now and name it as you want, for example(SWITCHONE).

DM 20220701150420 014

DM 20220701150420 015

  1. Then add channel to the SWITCHONE, fill in the name and label the one you want. The topic subscribe from ‘t ’ and the topic publish to ‘t/30:ae:7b:2b:4e:b1’. As for the data for ON/OFF value, you can refer to Dusun gateway communication protocol for mqtt.

DM 20220701150420 016

  1. Then choose a item type for the thing created, create a new item and link it with the thing.

DM 20220701150420 017

DM 20220701150420 018

  1. Finally it’s done, you can control the switch through the OpenHAB.

DM 20220701150420 019

  1. If you want to create the page in BASIC UI, you can create the switch.sitemap file in path ./openhab/conf/sitemaps. As for the grammar, you can refer to the link Sitemaps | openHAB

DM 20220701150420 020

A sample code is attached above the name SWITCHONE_SwitchOnff is the one of the channel you created.

  1. Then you can control it in the BASIC UI.

DM 20220701150420 021