Dimmer with http binding

Hi all,

I have tried all options like “CHANGED:GET”, “CHANGED:POST” and “INCREASE:GET” in http binding to do dimmer. But I couldn’t able to make it work.

Can you give any suggestion how to dimming with http.

the binding code in items

Switch  test1 "test" (GF_Living) { http=">[ON:GET:] >[OFF:GET:]" }


Dimmer Intensity "Intensity[%d]" <slider> (GF_Living) { http=">[INCREASE:GET:] }

For testing I have passed on in . But actually I have to pass slider value instead of on. Is it possible? If possible how can I do it?

please help asap!

I’m just in the middle of doing the same thing. This is how I have set up the bindings and they are working:

[*:GET:http://user:password@$s] <[http://user:password@$.properties.value)]

As you can see I’m doing both, writing and reading to get feedback as well, as I’m controlling the dimmers from Fibaro HC2 as well.

I’m still working on getting the feedback actually update the slider information in OpenHAB though

Ok .Thank you.

I will try.

How can I enable slider button .I have tried to create slider button. But I am able to get only 10% and 100% and i am not remaining values. That means if I click increase button it increase to 10% and if click again it goes to 100%. Same with decrease button. How can i get other values.

that depends on the lights you are using. Example in my setup I use the hue lux bulbs and my dimmers look like this.

Dimmer Light_LivRoom_Steps_Dim “Steps Dimmer” (LivRoom, Lights, LivRoom_AllLights, gDashboard) {hue=“1;brightness;40”}

The particule part is brightness;40, what this is doing is setting the value of the light state between 0 - 255. so weather I hit up or down its going by 40. Note thie is on the openhab html page. This is not however a percentage value. As far as sending you could do it very simply by doing this

This will send a PERCENTAGE VALUE to be sent to the light bulb.

Again I’m not sure which light bulbs you are using but this is how I do it with the Hue lux bulbs and the hue binding.

Ok Thanks for suggestion.

Its ok but I want like this if I press increase button in slider it should increase gradually like 10%,20%,etc so on upto 100%. How can I achieve this?

The lights that you are using, the binding might actually need a percentage value. The other suggestion I have would be creating a rule. Heres a “dummy” switch I have created that controls 2 lights within my living room.

Dimmer Light_LivRoom_AllLights_Dim  	<hue>	(LivRoom_AllLights, gDashboard)

Here is the rule I have.

rule "Living Room Dimmer"
		Item Light_LivRoom_AllLights_Dim received command
		var Number bVal = 0
		if(Light_LivRoom_AllLights_Dim.state instanceof PercentType) bVal = Light_LivRoom_AllLights_Dim.state as PercentType 
		if(receivedCommand==INCREASE) bVal = bVal + 25
		if(receivedCommand==DECREASE) bVal = bVal - 25

		if(bVal<0)   bVal = 0
		if(bVal>100) bVal = 100
		sendCommand(Light_LivRoom_Steps_Dim, bVal)
		sendCommand(Light_LivRoom_Candles_Dim, bVal)
		if(bVal>0) postUpdate(Light_LivRoom_AllLights_Sw, ON)
		if(bVal==0) postUpdate(Light_LivRoom_AllLights_Sw, OFF)

As you can see everytime I am hitting down i am diming the lights by 25%. The value is set as a PercentType. I hope this helps.

Hello,I want to get the value of the Dimmer and send it via TCP Bindings.But it does not work.Could you give some help?Thanks very much.Following is the Bindings code:

Hey Robert,

how am I suppose to write the http binding for it??

Kindly note that I am using open hab as a client which sends the http requests to my esp 8266 server.

Hi Robert,

I am very new to Openhab2 and was trying to use the slider for my led using esp8266 but not able to pass the slider value into the URL.
When I am using static URL it is working.
Dimmer MyDimmer “Dimmer [%d %%]” { http=">[CHANGED:GET:]" }
But this is not working
Dimmer MyDimmer “Dimmer [%d %%]” { http=">[CHANGED:GET:$d]" }

Please let me know where I am making the mistake.

It is working now after enabling the HTTP binding Format option to true from Paper UI.

1 Like

very strange… in openhab 2.2.0-SNAPSHOT when I enabled HTTP Binding Format in the binding settings for http, I got in a loop the following error:

2017-12-19 21:14:21.060 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.lang.NullPointerException: null
        at java.util.regex.Matcher.getTextLength(Matcher.java:1283) [?:?]
        at java.util.regex.Matcher.reset(Matcher.java:309) [?:?]
        at java.util.regex.Matcher.<init>(Matcher.java:229) [?:?]
        at java.util.regex.Pattern.matcher(Pattern.java:1093) [?:?]
        at org.openhab.io.net.http.HttpUtil.extractCredentials(HttpUtil.java:278) [219:org.openhab.core.compat1x:2.2.0]
        at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:181) [219:org.openhab.core.compat1x:2.2.0]
        at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:130) [219:org.openhab.core.compat1x:2.2.0]
        at org.openhab.binding.http.internal.HttpBinding.getCacheData(HttpBinding.java:423) [215:org.openhab.binding.http:1.11.0]
        at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:169) [215:org.openhab.binding.http:1.11.0]
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [219:org.openhab.core.compat1x:2.2.0]
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [219:org.openhab.core.compat1x:2.2.0]

after editing my http.cfg loop with errors stops. and binding format works!

hi robert,

did you get this working? i am running in to same problem