I am somehow trying to migrate a similar thing from 2.5 (http v1) to 3.0
Before I used the following item to reboot my weatherstation webserver: Switch LOCALWEATHER_observerreboot "Reboot Wetterstation" {http=">[ON:GET:http://192.168.1.5/msgreboot.htm] >[OFF:GET:http://192.168.1.5/msgreboot.htm]"}
Just firing this URL initates a reboot.
With the 3.0 http binding I would still like to keep it in a things file but struggle in migrating this.
By the way:
I love OH3 - even though the migration takes some time and causes significant effort, but the Main UI is much better and the option of merging 2 http items into one (command and state) is a great advantage (among others.
Thanks to @J-N-K for your help on the BASIC_PREEMPTIVE authentication topic
Should do. You need to make the group-matching-part non-greedy, that is done my appending ? to the quantifier. Otherwise .* will match everything as long as the rest can still me satisfied. Since . matches everything (including the EOL-characters), it’ll match everything until the last \n. You can test your regular expressions at Free Online Java Regular Expression Tester - FreeFormatter.com.
Well it does. But the regex needs to match the full response. REGEX:.*InputCH3=([A-Z]*).* works. .*InputVCH3=(.*?)\s.* also works. The missing .* at the end prevented the part after the matching group to match, why the regex did not match at all.
Hello everyone,
I’m a beginer in OH. I’m using OH3 and I’d like to configure a http url thing to execute command and request the state to a web server, using get and post methods. I’m able to modify the php web files to test trought openhab.
I tested the get method to read and write an output at time. After this, I tried to modify the state request to read all status bits at a time to have best performance. But, when I introduce a regular expression in “State Trasformation” field, nothing changes: there is no error, but nothing is read anymore. Maybe it doesn’t match the regex.
To simplify the testing, I created a new channel of string type and configure it to read a string by get method. This example run correctly:
But when I add a regular expression, the linked point does not update. I tested a lot of regex, but always the same result.
This is a regex of the tested ones:
Now, it’s just to test it.
The page test_http.php returns the string “STATUSOK”.
I have upload it on a pubblic domain, you can try it at this link with GET the parameter out_stato
basic URL:
“http://www.igtek.eu/”
State URL Extension:
“test_http.php?out_stato”
I’ll be happy to extract anything, even the entire string, like without REGEX. After I have verified the functioning of any regex, I’ll go to modify the web page to return the status of the system and I’ll write the necessaried regexs.
I’m afraid that there are problems in my openhab 3 installation.