Gruenbeck SC 18

Hello everybody,

I try to read the water consumption via the Grünbeck SC18 with an HTTP Post request. Unfortunately the item does not get an update. If I try it manually in the browser I get data. Does somebody has any idea?
Here is the item:
Number Wasser “Wasserverbrauch” { http="<[:POST:http://192.168.xxx.xxx/mux_http?id=8997&show=D_Y_2_1~:10000:REGEX(.?<D_Y_2_1>(.?)</D_Y_2_1>.)]" }

Answer manual request: ok<D_Y_2_1>141</D_Y_2_1>

Thanks
Dirk

Number Wasser “Wasserverbrauch” { http="<[:POST:http://192.168.xxx.xxx/mux_http?id=8997&show=D_Y_2_1~:10000:REGEX(.*<D_Y_2_1>(.*)</D_Y_2_1>.*)]" }

REGEX:

"ab?" -> a or ab
"ab*" -> a, ab, abb, abbb, abbbb ...

Hi Udo,

can you explain it to me a little bit more? Thanks for your help :wink:

Udo was pointing out that a ? is used to match any ONE character (including nothing) character only
As a consequence, in your expressions

is trying to match ONE character and you do not pick up the 141 (THREE characters) that you get by manual request, you may want to use (.*) instead, also I believe you will need to escape the forward slash / which means you may want to try \/
https://regex101.com/ is a great tool to test regex expressions

If you are just interested in the numerical value and it is always three digits, you could try (\d{3}) as your regex expression

Hi Markus.

thanks a lot, this helps.

Dirk

I tried your proposal (\d{3}) on the site regex101.com and it works but in openhab I get this message in the log file "2017-08-13 17:30:12.654 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘verbrauch.items’ has errors, therefore ignoring it: [24,40]: mismatched character ‘d’ expecting set null
[24,116]: mismatched input ‘{’ expecting RULE_STRING
[24,117]: extraneous input ‘3’ expecting ‘}’"
Do you have any idea?

Sorry, I am not using REGEX regularly enough to remember all the little stumbling blocks I found…could it be that you need a double parenthesis around it? There are quite a few REGEX threads (lots of users have difficulties) here on the forum, maybe you can glean some info.

Don’t try to make it too difficult :wink: either use (…) for exactly 3 characters, or use (.*) for as many characters as there are between the fences.

1 Like