Switch status change doesn't work

Hi all,

The coupling between OH2 and my home domotic system works. I can switch lights on and off with OH2. However when I switch the light with the physical switch the status in OH2 is not updated. In the log file you see that the httpclient is given the status back every 10 seconds as programmed. Also no REGEX errors. What am I doing wrong?

Switch LE_Spots "Spots" {http=">[ON:GET:http://localhost:8888/icontrol.dll?ccmd=omd.4.out6.on] >[OFF:GET:http://localhost:8888/icontrol.dll?ccmd=omd.4.out6.off] <[http://localhost:8888/icontrol.dll?ccmd=omd.4.out6&terse:10000:REGEX((.*))]"}

Log file content
2017-09-13 09:29:50.208 [DEBUG] [httpclient.wire.header ] - >> "GET /icontrol.dll?ccmd=omd.4.out6&terse HTTP/1.1[\r][\n]"
2017-09-13 09:29:50.212 [DEBUG] [httpclient.wire.header ] - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2017-09-13 09:29:50.219 [DEBUG] [httpclient.wire.header ] - >> "Host: localhost:8888[\r][\n]"
2017-09-13 09:29:50.224 [DEBUG] [httpclient.wire.header ] - >> "[\r][\n]"
2017-09-13 09:29:50.260 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:29:50.262 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:29:50.265 [DEBUG] [httpclient.wire.header ] - << "Date: Wed Sep 13 09:29:50 2017[\r][\n]"
2017-09-13 09:29:50.268 [DEBUG] [httpclient.wire.header ] - << "Server: xWRC[\r][\n]"
2017-09-13 09:29:50.277 [DEBUG] [httpclient.wire.header ] - << "Pragma: no-cache[\r][\n]"
2017-09-13 09:29:50.280 [DEBUG] [httpclient.wire.header ] - << "Cache-Control: no-cache[\r][\n]"
2017-09-13 09:29:50.283 [DEBUG] [httpclient.wire.header ] - << "Content-type: text/plain[\r][\n]"
2017-09-13 09:29:50.285 [DEBUG] [httpclient.wire.header ] - << "Content-length: 1[\r][\n]"
2017-09-13 09:29:50.288 [DEBUG] [httpclient.wire.header ] - << "[\r][\n]"
2017-09-13 09:29:50.291 [DEBUG] [httpclient.wire.content ] - << "0"
2017-09-13 09:30:00.304 [DEBUG] [httpclient.wire.header ] - >> "GET /icontrol.dll?ccmd=omd.4.out6&terse HTTP/1.1[\r][\n]"
2017-09-13 09:30:00.307 [DEBUG] [httpclient.wire.header ] - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2017-09-13 09:30:00.310 [DEBUG] [httpclient.wire.header ] - >> "Host: localhost:8888[\r][\n]"
2017-09-13 09:30:00.313 [DEBUG] [httpclient.wire.header ] - >> "[\r][\n]"
2017-09-13 09:30:00.344 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:00.347 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:00.350 [DEBUG] [httpclient.wire.header ] - << "Date: Wed Sep 13 09:30:00 2017[\r][\n]"
2017-09-13 09:30:00.353 [DEBUG] [httpclient.wire.header ] - << "Server: xWRC[\r][\n]"
2017-09-13 09:30:00.355 [DEBUG] [httpclient.wire.header ] - << "Pragma: no-cache[\r][\n]"
2017-09-13 09:30:00.358 [DEBUG] [httpclient.wire.header ] - << "Cache-Control: no-cache[\r][\n]"
2017-09-13 09:30:00.365 [DEBUG] [httpclient.wire.header ] - << "Content-type: text/plain[\r][\n]"
2017-09-13 09:30:00.368 [DEBUG] [httpclient.wire.header ] - << "Content-length: 1[\r][\n]"
2017-09-13 09:30:00.370 [DEBUG] [httpclient.wire.header ] - << "[\r][\n]"
2017-09-13 09:30:00.373 [DEBUG] [httpclient.wire.content ] - << "0"
2017-09-13 09:30:10.386 [DEBUG] [httpclient.wire.header ] - >> "GET /icontrol.dll?ccmd=omd.4.out6&terse HTTP/1.1[\r][\n]"
2017-09-13 09:30:10.388 [DEBUG] [httpclient.wire.header ] - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2017-09-13 09:30:10.397 [DEBUG] [httpclient.wire.header ] - >> "Host: localhost:8888[\r][\n]"
2017-09-13 09:30:10.400 [DEBUG] [httpclient.wire.header ] - >> "[\r][\n]"
2017-09-13 09:30:10.432 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:10.434 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:10.436 [DEBUG] [httpclient.wire.header ] - << "Date: Wed Sep 13 09:30:10 2017[\r][\n]"
2017-09-13 09:30:10.438 [DEBUG] [httpclient.wire.header ] - << "Server: xWRC[\r][\n]"
2017-09-13 09:30:10.440 [DEBUG] [httpclient.wire.header ] - << "Pragma: no-cache[\r][\n]"
2017-09-13 09:30:10.443 [DEBUG] [httpclient.wire.header ] - << "Cache-Control: no-cache[\r][\n]"
2017-09-13 09:30:10.445 [DEBUG] [httpclient.wire.header ] - << "Content-type: text/plain[\r][\n]"
2017-09-13 09:30:10.447 [DEBUG] [httpclient.wire.header ] - << "Content-length: 1[\r][\n]"
2017-09-13 09:30:10.453 [DEBUG] [httpclient.wire.header ] - << "[\r][\n]"
2017-09-13 09:30:10.456 [DEBUG] [httpclient.wire.content ] - << "1"
2017-09-13 09:30:20.466 [DEBUG] [httpclient.wire.header ] - >> "GET /icontrol.dll?ccmd=omd.4.out6&terse HTTP/1.1[\r][\n]"
2017-09-13 09:30:20.468 [DEBUG] [httpclient.wire.header ] - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2017-09-13 09:30:20.469 [DEBUG] [httpclient.wire.header ] - >> "Host: localhost:8888[\r][\n]"
2017-09-13 09:30:20.470 [DEBUG] [httpclient.wire.header ] - >> "[\r][\n]"
2017-09-13 09:30:20.500 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:20.501 [DEBUG] [httpclient.wire.header ] - << "HTTP/1.0 200 OK[\r][\n]"
2017-09-13 09:30:20.502 [DEBUG] [httpclient.wire.header ] - << "Date: Wed Sep 13 09:30:20 2017[\r][\n]"
2017-09-13 09:30:20.503 [DEBUG] [httpclient.wire.header ] - << "Server: xWRC[\r][\n]"
2017-09-13 09:30:20.504 [DEBUG] [httpclient.wire.header ] - << "Pragma: no-cache[\r][\n]"
2017-09-13 09:30:20.506 [DEBUG] [httpclient.wire.header ] - << "Cache-Control: no-cache[\r][\n]"
2017-09-13 09:30:20.507 [DEBUG] [httpclient.wire.header ] - << "Content-type: text/plain[\r][\n]"
2017-09-13 09:30:20.509 [DEBUG] [httpclient.wire.header ] - << "Content-length: 1[\r][\n]"
2017-09-13 09:30:20.510 [DEBUG] [httpclient.wire.header ] - << "[\r][\n]"
2017-09-13 09:30:20.511 [DEBUG] [httpclient.wire.content ] - << “1”

Please also put your log files in code fences

```
logs, rules, code, etc go here
```

Try using a MAP transform instead of REGEX to map 0 to OFF and 1 to ON (or vise versa).

Thanks you very much Rich, you solved the problem (I’ll also follow your advice for code fences).

Solution: Install the MAP transformation binding and change items file as follows

<[http://localhost:8888/icontrol.dll?ccmd=omd.4.out6&terse:10000:MAP(onoff.map)]

onoff.map

0=OFF
1=ON
1 Like