HTTP binding always returns NULL from xml

I am running OpenHab 2 on a Raspi3.

Since days I am not able to sort out the following problem:

I installed the HTTP binding in PaperUI.

http.cfg:

timeout=1000
granularity=1000
format=true
panazustand.url=http://192.168.0.248:55000/dmr/ddd.xml
panazustand.updateInterval=1000

The IP refers to my Panasonic Smart TV. ddd.xml starts as follows, when I enter the url to my browser:

10
urn:schemas-upnp-org:device:MediaRenderer:1
49EX600_Series
Panasonic
Panasonic VIErA
TX-49EX600W
uuid:4D454930-0100-1000-8001-D8AFF1B13DD2
uuid:4D454930-0000-1000-8001-D8AFF1B13DD2
uuid:4D454930-0100-1000-8001-D8AFF1B13DD2
uuid:4D454930-0200-1000-8001-D8AFF1B13DD2
4726525383056154
… and so on…

I just want to check whether this file exists. If yes, the TV is on. If no, the TV is off.

Therefore I created the following code (based on the idea of another user found here: Get current state (on/off) of panasonic tv )

Items:

String Test { http="<[panazustand:1000:REGEX([0-9])]"}

Item “Test” should be Null if the file does not exist. It should be “1” (the first character of the ddd.xml) if it exists.

Then I have a rule created:

rule "Test"

when
Item Rainer_Tablet_Ping changed
then
        logInfo("TV", Test.state.toString)
end

My expectation was that this writes either “null” or “1” (the first character of the ddd.xml) to the log-File.
Unfortunately it does not.

The REGEX you use needs to match the entire message. The REGEX you have defined matches only a return that consists of a single digit.

If you want to match the first character of the return and return is to your Test Item you need a REGEX along the lines of:

REGEX(^([0-9]).*)

This will match ONLY return values that start with a digit.

But you mention this is XML. XML will NEVER start with a digit. XML has all sorts of tags that define the structure of the text with each tag starting with <. You need to look at the raw source of the data returned and construct an appropriate REGEX. The browser will hide all of those tags from you.