HTTP Binding Problem


i have a HTTP Binding Problem an i need help please :

i have a web based IP Thermometer and i want to use the Themperatur which is displayed be the Web IP Thermometer in the openhab. The HTTP respone from my web based thermometer looks like

State Name Type Current Value
5.1 °C
24.8 °C
The temperatures are outside 5.1 and inside 24.8

I designed the regex: for inside (.*?s216">)(-?\d{1,3}.\d{1}) which returned the following two strings. Testsed it with the site

index 0
position 855
$ 1

$ 2 24.8

so far so good

openhab.cfg i added HTTP Bindings

demo.items i added
Number ThermoInnen “ThermoInnen [%.1f °C]” {http="<[IPThermometer:1000:REGEX(.*?s215">)(-?\d{1,3}.\d{1})]"}

demo.sitemap i added
Number item=ThermoInnen “ThermoInnen [%d C]” icon=“temperature-max”

.items file i added
Number ThermoInnen “ThermoInnen [%.1f °C]” {http="<[IPThermometer:1000:REGEX(.*?s215">)(-?\d{1,3}.\d{1})]"}

But the digits 24.8 are not displayed!

Nnow my questions

  1. Question
    how can i get the $ 2 24.8 wich is returned bei the regex, and how can i display the digists

plaese say me how i can extract the digits 24.8 from my web based thermometer an how can i display the digits. i am open for other ways, because my way is not running

Thank you verrrrrrrrrrrrrrrrrrrrrrrrrry mutch


I see two things, one which is certainly a problem and the other is a maybe problem.

The syntax for the REGEX clause is “REGEX()” but you have “REGEX()()”. At best the stuff in the second set of parens will be ignored. At worst it will cause OH to reject the entire Item as being syntactically incorrect. So try:

Number ThermoInnen "ThermoInnen [%.1f °C]" {http="<[IPThermometer:1000:REGEX((.*?s215">)(-?\d{1,3}.\d{1}))]"}

Lets see if that works. If it does don’t worry about the second. If not, I’d recommend simplifying the REGEX by eliminating the two matching groups so it only matches the number by eliminating the first set of parens. You also may need to escape the " with a backslash.