OpenHab2 Parse HTTP and Read Array of Adresses - Internorm - Mediola Gateway

I am somewhat new to OpenHAB - while I already use OpenHAB with my KNX Installation on my iPhone basically only as a remote - I now would like to go one step further into the “automation” of things.

Unfortunately when building my house I used the “Internorm Smart Window” Solution to capture the state of my windows (Open, Closed, Tilted). This solution is basically a modified Mediola Gateway V4.

Now I would like to make these window states also available in OpenHAB in order to automate my shutters. (e.g. When a window is open and it starts to rain then the shutter shall close, … )

I already was able to read out the statuses via a http call that looks like follows:

This will result in the following html feedback:


The syntax is that:

  • the “adr” is the Adress of a window (e.g. 01366B02 = Bathroom Window)
  • the 3rd and 4th digit of the state is the state of the window (12=closed, 10=open, 11=tilted)

Now - my Problem is that I do not know how to extract the status of each window and make it usable in OpenHab for further processing / logic.
I tried to use RegEx, but not very successful - I was able to find the state of a adress with the following RegEx - but I do not really know how to make use of it:


Since I do know which window I am adressing I would only need the status back.

Guess this is a very basic question - guess I am only missing that little hint…

thanks in advance

That looks like valid JSON so perhaps the JSONPATH transform would be a better choice. However, that will keep the " around the value returned. If that will be a problem you may want to use the JS transform.

See the Comprehensive Wunderground using HTTP Binding Example for a detailed example using Wunderground weather data.

Hmm… I am not (yet) too familiar with JSON/REGEX… but when I try to check if my response is a valid JSON (using then it appears it is not quit a valid JSON.

Reading through your WU example it appears you are doing most with JSONPATH. Yet I found one with RegEx - but somehow I am not able to only retrieve the window state (e.g. 12 = open) using my RegEx statement - and don’t know how to make use of the response?!

Something that I found out was that only a few changes to the HTTP response would make this a valid JSON:

  1. Put the XC_SUC in Quotes ("")

  2. Add a : right before the [

  3. Move the } after XC_SUC to the very end

So the resulting JSON would be:


So while I now know how to manually transfer my response into a valid JSON - I do not know how to do this programatically and how to only extract the window state I actually need!?

Guess this is a very very basic question - too basic?
anyway… thanks for your help - and I will definetely copy your WU solution once I am able to read my window states…

OK, if it isn’t valid JSON you are stuck with REGEX or you have to use JS to make the changes you identified and then you can parse the JSON using JavaScript, but that would probably be overkill.

There are online REGEX testers, this one was the top of Google’s results.

To use your REGEX, follow the instructions in the HTTP binding’s readme:

  1. Create a cache configuration

  2. Create an Item for each address

  3. Following the example:

    Number temperature { http="<[weatherCache:10000:XSLT(demo_yahoo_weather_temperature.xsl)]" }

You would replace the information listed in the example with your information. Your REGEX replaces the XSLT part.

Hello - thanks for your support. I will try to work with RegEx and see how far it gets me.
I am already in the process of setting up a parallel OpenHab Installation in order to “test” things…

wish me Luck…

On more night - and it appears I am still struggeling. I now tried both, the cached mode and the direct one - but I only get a “null” back in my Visu.

In my Items file I use the following entry (uncached) to obtain the response from my windows:

String  Inter_Norm "internorm [%s ..]" <window>	(EG_Flur) {http="<[*?:(.*?):)]"}

If I test the RegEx using it appears to be valid.

Also I did install the http binding with the following http.cfg:

# timeout in milliseconds for the http requests (optional, defaults to 5000)

# the interval in milliseconds when to find new refresh candidates
# (optional, defaults to 1000)

# whether to substitute the current time or state value into the URL
# (optional, defaults to true)

# configuration of the first cache item

# configuration of the second cache item  

With the above I also tried to get something back using the following line in the items file - without success.:

String  internorm "internorm [%s ...]" <window>	(EG_Flur) {http="<[internorm:36000:REGEX(B02.*?:(.*?):)]"}

In both cases I get the same result:

May I ask again for your help…

First, change to a default REGEX (i.e. REGEX((.*))) to make sure there isn’t something big wrong (i.e. the data is not arraiving, you don’t have REGEX installed, etc. You can see in events.log what the Item is being updated to.

I notice that in http.cfg your URL ends with GetStates.json but in your direct Item it is missing the .json.

Assuming you have REGEX and it is able to process, then I expect it has to do with some quirk of the particular REGEX implementation in Java. It has many noted quirks. The first thing I would try is add a .* before and after your current one to match to all the stuff that could occur before and after the part you care about.


You really should not be relying solely on the UI when trying to do something like there. There is so much that occurs between your webserver and the sitemap that the fact that it shows up null there means only that something went wrong with no hint as to where.

NOTE: the fact that it is showing null rather than - or NULL probably means that your REGEX is not matching. I would expected to see something in the logs.

You are so great!! Thanks a lot - your Regex statement fixed my Problem… or at least the first one.
I altered the regex a bit and it now responds perfectly with a 12 - just as desired… now I try get it to work in cached mode and try to transfer the response into something useful - to build a logic ontop of it…


again - thanks so much for your continued help!

Hello Andreas,

i am interested in the same solution!
i want to integrate my internorm windows with mediola gateway in openhab.
has someone a good documentation / a working evironment an dcan help?

kind regards,


Hello Oliver,

here’s some documentation on what I did - first of all you need to know that I only have the window contacts! I do not have any blinds or vents from Internorm integrated!

Getting the window states:
http://Your Mediola Gateway IP/command?XC_FNC=GetStates

This should give you an Output like:


Binding Config --> Services/http.cfg

internormCache.url=http://Your Mediola Gateway IP/command?XC_FNC=GetStates

Item Configuration:

String http_binding_test “This is a test [MAP(]” {http="<[internormCache:10000:REGEX(.B01.?:…(.?):.)]"}

Mapping File -->


Hope this helps?!