This post describes the way to integrate the Dusun IoT gateway to OpenHAB platform in steps.
- Download OpenHAB from the link Download openHAB | openHAB
- Open the OpenHAB web client, enter the paper UI page
- Pair one zigbee device with our gateway, as for an example, we used a socket to control switch on/off.
- Enter the OpenHAB webpage and enter PAPER UI.
- Choose Add-ons, BINDINGS and type in mqtt, and install.
- Choose the MISC page and install MQTT Broker Moquet.
- 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.
- 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).
- 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.
- Then choose a item type for the thing created, create a new item and link it with the thing.
- Finally it’s done, you can control the switch through the OpenHAB.
- 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
A sample code is attached above the name SWITCHONE_SwitchOnff is the one of the channel you created.
- Then you can control it in the BASIC UI.