This instructable tells you how to operate Armtronix IOT hardware using the http configurations in the openHAB.Using this you will be able to ON OFF the relay, compared to mqtt the http is more reliable.The above screen shot shows the openHAB browser page, and in the second image you will be able to see the ON/OFF buttons for fan and also the Dimmer to control the fan. In the the further steps we will give clear information about how to modifiy in the demo.items, demo.sitemap and demo.rules files.

Step 1: Url Link of Device

Before procceding to the configuration, lets note some information. Open the IP address of the device in browser to which you want to operate in http. As shown in the image above for instance we are trying to control IP adrress, after opening this you can see this in the screenshot, click on the control GPIO there the next page opens where you will be able to control gpio, click on ON or OFF button when you press submit their it shows the link in url to control the ON or OFF depending on the button you have clicked. This can be seen in the image 3 where the url is highlighted.i.e

Keep a record of above link, while configuration of demo.items we need that information.Currently we are using the Wifi Dimmer/Speed control board based on esp8266 ,Triac

Step 2: Step2: Configuration in OpenHAB for Http

In the demo.sitemap file for instance we have created the Switch item and labeled it as shown below and also you can find it in the image 1

Switch item=Fan_htp label="Fan"

similarly for dimmer we have created the Slider item and labeled it

Slider item=Fanspeed_htp label="Fan Speed"

Now goto the demo.items file there create Switch with the name Switch item created in the sitemap so that it can link and do the http binding for ON and OFF, this syntax is shown as below.

Switch Fan_htp "Fan" (htp,Lights) {http=">[ON:POST:] >[OFF:POST:]"}

Here the http link is pasted from the information collected in the step1

similarly for the dimmer the syntax is

Dimmer Fanspeed_htp "Fan Speed[%s]" {http=">[*:GET:$s]"}

In the above syntax Dimmer Fanspeed_htp receives the percentage value and passes to the state_dimmer through%2$s

After this goto demo.rule file there create a rule to operate the speed according to increase and decrease of dimmer, an link the variable to the dimmer.

rule "Dimmed Light"
when Item Fanspeed_htp received command then var Number percent = 0

if(Fanspeed_htp.state instanceof DecimalType) percent = Fanspeed_htp.state as DecimalType if(receivedCommand==INCREASE) percent = percent + 5 if(receivedCommand==DECREASE) percent = percent - 5

if(percent<0) percent =0 if(percent>100) percent= 100



this rule file can be found in the image 3.

About This Instructable




More by Armtronix:OpenHAB http binding with Armtronix Dimmer/Speed Control Board  Accessing Devices Connected to Router From Remote Place (using Pi and OpenHab) How to Configure Static IP Address for Raspberry Pi 
Add instructable to: