HTTP Binding for dimmers and status

hi

I am trying to use the HTTP binding for a dimmer / Switch. I have included the urls below which i know work. I cant seem to figure out the syntax for the items. The switch (ON /OFF) is working correctly but i am not sure what syntax to use for dimmer.

Thanks in advance. I looked through several topics on the forum on this but its not still not clear to me.

Below are the Urls and items i created in the items files. I kow the urls are correct because when i use them in a browser, they perform the action correctly.

Following item works:
Switch DiningRoomLight “DiningRoom Light” { http=">[ON:POST:http://192.168.1.30:8688/controller/rest/control/1087/ON] >[OFF:POST:http://192.168.1.30:8688/controller/rest/control/1087/OFF]" }

This one does not:
Dimmer DinningRoomLightValue “DiningRoom Light Value” { http=">[*:GET:http://192.168.1.30:8688/controller/rest/control/62/%b]" }

Also what should be the syntax for getting the Staus of the switch and dimmer. The urls are as follows:
Switch status:
http://192.168.1.30:8688/controller/rest/status/588158”,

Dimmer value:
http://192.168.1.30:8688/controller/rest/status/588157

try (not tested):

Dimmer DinningRoomLightValue "Dinning Room Dim: [%d %%]"  {http=">[*:POST:http://192.168.1.30:8688/controller/rest/control/1087/%2$s] <[http://192.168.1.30:8688/controller/rest/status/588157]"}

Ps: How to use code fences

hello

thanks for your suggestion. Unfortunately that did not work.

what should the value for the http format (under htttp binding settings) be set to for the % character to work correctly?

when i issue http://192.168.1.30:8688/controller/rest/control/62/50 in a browser, it sets the value of the dimmer correctly to 50%. I cant figure out how to pass a value to the dimmer from openhab dimmer? i have a widget setup on habpanel as a dimmer and i am mapping the item dimmer to it.

i tried replacing 1087 with 62 in the suggestion you had provided (because 62 is the address of the dimmer) but no luck

logs shows:
==> /var/log/openhab2/events.log <==
2018-11-21 13:06:43.265 [ome.event.ItemCommandEvent] - Item ‘DinningRoomLightValue’ received command 10
2018-11-21 13:06:43.341 [vent.ItemStateChangedEvent] - DinningRoomLightValue changed from NULL to 10
2018-11-21 13:06:45.852 [ome.event.ItemCommandEvent] - Item ‘DinningRoomLightValue’ received command 48
2018-11-21 13:06:45.866 [vent.ItemStateChangedEvent] - DinningRoomLightValue changed from 10 to 48
2018-11-21 13:06:47.085 [ome.event.ItemCommandEvent] - Item ‘DinningRoomLightValue’ received command 61
2018-11-21 13:06:47.097 [vent.ItemStateChangedEvent] - DinningRoomLightValue changed from 48 to 61

below are some additional erros in the log

2018-11-21 12:56:32.387 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘trial.items’
2018-11-21 12:56:32.415 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type ‘http’ of item ‘DinningRoomLightValue’ could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp ‘(.?)({.})?:(?!//)(\d*):(.)’
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:51) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:397) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:366) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:229) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:432) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:301) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:123) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:227) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:291) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:240) [101:org.eclipse.smarthome.core:0.10.0.201811171951]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: org.openhab.model.item.binding.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseInBindingConfig(HttpGenericBindingProvider.java:189) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:153) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:119) ~[?:?]
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:49) ~[?:?]
… 10 more
2018-11-21 12:56:32.487 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type ‘http’ of item ‘DinningRoomLightStatus’ could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:51) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:397) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:366) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:229) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:432) [128:org.eclipse.smarthome.model.item:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:301) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:123) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:227) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:291) [127:org.eclipse.smarthome.model.core:0.10.0.201811171951]
at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:240) [101:org.eclipse.smarthome.core:0.10.0.201811171951]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: org.openhab.model.item.binding.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseInBindingConfig(HttpGenericBindingProvider.java:189) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:153) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:119) ~[?:?]
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:49) ~[?:?]
… 10 more
2018-11-21 12:56:33.580 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘trial.items’
2018-11-21 12:56:33.605 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type ‘http’ of item ‘DinningRoomLightValue’ could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:51) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:397) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:366) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:229) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:432) ~[?:?]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:301) ~[?:?]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:139) ~[?:?]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:227) ~[?:?]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:291) ~[?:?]
at org.eclipse.smarthome.core.service.WatchQueueReader.lambda$3(WatchQueueReader.java:323) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: org.openhab.model.item.binding.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseInBindingConfig(HttpGenericBindingProvider.java:189) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:153) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:119) ~[?:?]
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:49) ~[?:?]
… 16 more
2018-11-21 12:56:33.708 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type ‘http’ of item ‘DinningRoomLightStatus’ could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.)’
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:51) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:397) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:366) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:229) ~[?:?]
at org.eclipse.smarthome.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:432) ~[?:?]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:301) ~[?:?]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:139) ~[?:?]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:227) ~[?:?]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:291) ~[?:?]
at org.eclipse.smarthome.core.service.WatchQueueReader.lambda$3(WatchQueueReader.java:323) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: org.openhab.model.item.binding.BindingConfigParseException: bindingConfig ‘http://192.168.1.30:8688/controller/rest/status/588157’ doesn’t represent a valid in-binding-configuration. A valid configuration is matched by the RegExp '(.
?)({.})?:(?!//)(\d):(.*)’
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseInBindingConfig(HttpGenericBindingProvider.java:189) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.parseBindingConfig(HttpGenericBindingProvider.java:153) ~[?:?]
at org.openhab.binding.http.internal.HttpGenericBindingProvider.processBindingConfiguration(HttpGenericBindingProvider.java:119) ~[?:?]
at org.openhab.core.binding.internal.BindingConfigReaderDelegate.processBindingConfiguration(BindingConfigReaderDelegate.java:49) ~[?:?]
… 16 more
2018-11-21 12:58:31.152 [WARN ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at ‘items/DinningRoomLightStatus’ with an invalid status value ‘http://192.168.1.30:8688/controller/rest/control/62/50’.

Did you see this? I’m polling the REST API of DeConz. Maybe you find something useful. Read the posts after the solution as well.

Thanks but unfortunately i didnt find anything relavant. I tried using wireshark to see the actual url sent by openhab and whati am observing is that excep for item and widget type “switch” which are working, i dont see the dimmer sending out any messages at all.

I used a switch type with fixed dim values for on and off and they seem work fine. in the imtem below, ON sets the dimmer value to 87 and off sets the value to 19.

Switch DiningRoomLightTest “DiningRoom LightTest” { http=">[ON:POST:http://192.168.1.30:8688/controller/rest/control/62/87] >[OFF:POST:http://192.168.1.30:8688/controller/rest/control/62/19]" }

However actual dimmer item does not seem to work and no messages are sent out when it is tied to a dimmer widget on habpanel.

Dimmer DinningRoomLightValue “Dinning Room Dim: [%d %%]” {http=">[CHANGED:POST:http://192.168.1.30:8688/controller/rest/control/62/%2$s] <[http://192.168.1.30:8688/controller/rest/status/588157]"}

Also, how do get the current status to show up on the habpanel- i tried creating the following item and mapped it to a dummy widget but it is not displaying the values correctly. This same url from a webbrowser returns the values correctly.

Number DinningRoomLightStatus “Dimmer Status” { http="<[http://192.168.1.30:8688/controller/rest/status/588158]" }

how does it come up in HABPanel? Does it work ok on BasicUI?

try:

Number DinningRoomLightStatus "Dimmer Status [%d %%]" { http="<[http://192.168.1.30:8688/controller/rest/status/588158]" }

Read: How to use code fences It is important :slight_smile:

it is not display any values at all… shows N/A

Where can i get the latest version of the http binding? may there are issues with the binding that comes with OH2.3

what is the exact output of the http call using a browser?

The http binding uses the same code for 1 year now: openhab1-addons/bundles/binding/org.openhab.binding.http at main · openhab/openhab1-addons · GitHub

URL : http://192.168.1.30:8688/controller/rest/status/588158

Returns:
<openremote xmlns=“http://www.openremote.org” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.openremote.org http://www.openremote.org/schemas/controller.xsd”>

<status id=“588158”>on</status>

</openremote>

URL : http://192.168.1.30:8688/controller/rest/status/588157

Returns:
<openremote xmlns=“http://www.openremote.org” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.openremote.org http://www.openremote.org/schemas/controller.xsd”>

<status id=“588157”>72</status>

</openremote>

this is how it is displayed on the browser? (if it’s not too much trouble, upload a screenshot please)

If this is the string output, you need another solution to process the value of interest (e.g. the 72)

image attached above. 588157 is the dimmer and 588158 is the switch. physically they are both in one switch / dimmer. I tried using the following for them:

Dimmer DinningRoomDimValue “Dinning Room Dim: [%d %%]” {http=">[CHANGED:POST:http://192.168.1.30:8688/controller/rest/control/62/%2$d] <[http://192.168.1.30:8688/controller/rest/status/588157]"}

Number DinningRoomDimStatus “Dimmer Status [%d %%]” { http="<[http://192.168.1.30:8688/controller/rest/status/588157]" }

Contact DinningRoomSwitchStatus “Switch Status” { http="<[http://192.168.1.30:8688/controller/rest/status/588158]"}

These 3 above dont seem to work. The two below are working:
Switch DiningRoomLight “DiningRoom Light” { http=">[ON:POST:http://192.168.1.30:8688/controller/rest/control/1087/ON] >[OFF:POST:http://192.168.1.30:8688/controller/rest/control/1087/OFF]"}

Switch DiningRoomLightTest “DiningRoom LightTest” { http=">[ON:POST:http://192.168.1.30:8688/controller/rest/control/62/87] >[OFF:POST:http://192.168.1.30:8688/controller/rest/control/62/19]" }

check: https://www.openhab.org/addons/transformations/xpath/

By the way: did you consider linking your Dimmer directly to openHAB2 and skip this openremote “man in the middle” ? :slight_smile:

Thanks I will review that transformations link.

I have tried using the zwave dimer directly with openhab but my observation is zwave implementation on Openremote it’s a lot more robust than the zwave binding in openhab.

ouch… (highly doubt it by the way)

that is going to hurt @chris 's feelings :japanese_ogre:

and now you are struggling for days to get an HTTP bound Dimmer Item to talk to your “middle-ware”… not worth it… I would definitely go direct.

Sorry definitely don’t mean to hurt anyone’s feelings :blush: it’s just my honest opinion… could be because I have been using openremote for over two years so could be just the familiarity factory.

I really hope I can get the http binding working. Openhab and Openremote together I think can provide a very powerful and flexible solution.

If anyone has any other ideas on how to make http binding work with the links I have included in my previous post, I would love to hear them and try them out.