Hi I discovered openHab
I have a lot personal IOT devices who work with HTTP get request
for example a switch to light the light are write
http://xxx.xxx.xxx/set.htm?D12=
the answer are the state of the relay.
I try different configuration but no are all functional.
when I used for exemple if the D12=1 i can change the state
but if I used of OFF to ON the request is launch but no change on my device.
what is the best configuration in this case, how to variabilise the get reqest ?
I try this configuration for the think :
UID: http:url:1f0999da96
label: Lampadaire Bureau ESP32
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: http://192.168.10.180/
delay: 0
stateMethod: GET
refresh: 100000
commandMethod: GET
contentType: text/html
timeout: 30000
bufferSize: 2048
location: Bureau
channels:
- id: switch
channelTypeUID: http:switch
label: switch
description: ""
configuration:
onValue: "0"
mode: READWRITE
offValue: "1"
stateExtension: get.htm?D12
commandExtension: set.htm?D12=
I waited the Best Solution and understand how to configure in the best way the add-on to used this component
Best.
HTTP Binding - URL Formatting
ok thanks
i already read that but I don’t understand how to do that.
I begining with openhab. and I don’t understand how to configure in the best way.
I want to used a switch with On and Off value
with ON=1 and Off=2
You’ll have to add the command to the URL:
UID: http:url:1f0999da96
label: Lampadaire Bureau ESP32
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: http://192.168.10.180/
delay: 0
stateMethod: GET
refresh: 100000
commandMethod: GET
contentType: text/html
timeout: 30000
bufferSize: 2048
location: Bureau
channels:
- id: switch
channelTypeUID: http:switch
label: switch
description: ""
configuration:
onValue: "0"
mode: READWRITE
offValue: "1"
stateExtension: get.htm?D12
commandExtension: set.htm?D12=%2$
// ^^^
I try that but i have an error in the openhab.log I have this error
2022-11-06 13:38:17.960 [INFO ] [nding.http.internal.HttpThingHandler] - Using the secure client for thing 'http:url:1f0999da96'.
2022-11-06 13:38:18.197 [INFO ] [nding.http.internal.HttpThingHandler] - Using the secure client for thing 'http:url:1f0999da96'.
2022-11-06 13:38:18.456 [INFO ] [nding.http.internal.HttpThingHandler] - Using the secure client for thing 'http:url:1f0999da96'.
2022-11-06 13:38:33.134 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:34.113 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:34.818 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:37.254 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:37.984 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:43.518 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
2022-11-06 13:38:44.417 [WARN ] [nding.http.internal.HttpThingHandler] - Creating request for 'http://192.168.10.180/set.htm?D12=%2$' failed: Conversion = '2'
Because, as mentioned in the documentation, you need to add the format parameter too. Try %2$s
instead of just %2$
.
If that doesn’t work, please share your new configuration.
Thanks a lot It’s OK now
Thanks for your proactivity
Sorry, missed the s… Could have sworn I typed that in…