OH3: HTTP-Binding RegExp / JS

You can’t change the user-agent

Oh. Thank’s for the information. Bad situation.
Does it work still on your setup? It looks like, there is now way to use it anyway.

I have the same behavior. It was working for a full year and suddenly stopped working since a week or so.
Can we perhaps change some settings in http.cfg to fix the issue?

For me it sounds like, there is now way to do this with the HTTP-Binding.
That’s why I tried it with EXEC and CURL.
https://community.openhab.org/t/re-oh3-http-binding-regexp-js/124348/2?u=roman_e

This is a clue it’s the other end that has changed, has become more picky about what user-agents it serves i.e. rejecting bots etc.

That’s interesting. I couldn’t open the link though; it seems to be broken.

I decided to use Exec and Curl too. Used -A option to indicate agent. Took me about 10 minutes to relink items. All seems to be working fine again. Thanks!

2 Likes

Hey,
I moved to a new appartement, stopped OH3 at my old appartement installed everything in my new appartement without changing anything an restated OH 3.

Everything works without Mobile Alerts.

The error at the log likes like this:

If I try directly inside browser with:
https://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=XXXXXX

it works without any problems.

I`ve restarted OH 3 2 times.

Does anyone knows what to do?
Thanks, Ansgar

Hey,
can you show, how you get it work?
Link of Roman_E doesn`t work.
Thanks.

Sure, create a shell script like

getMobileAlertsHTML.sh:

#!/bin/bash
curl https://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=XXXXXXXXX -A Mozilla

Then create a ‘Thing’ in OpenhabUI for ‘Exec’ binding as follows:

and that’s pretty much it. Your webpage data will now start coming in the output of this ‘Thing’. You can create channels, just like you would otherwise have done for using regular expressions to get the data.

1 Like

Hard to explain. Is there anything else in the logs? Can you enable TRACE logging, so we see what is actually send and received?

Thanks,
thing created and running:


But I can’t find where to create own channels:

At the old way it was no problem:

Apologies for the delay as I was busy.
It is similar. Here is my screenshot of how I added the channels.

Hey and thanks.
I have two problems:
At the log I found:


How can I fix it and where do I have to add it in which form to the whitelist?

To define the channels is now problem. But what is the right way?
Is it OK in this way:

The whitelist is located at /etc/openhab/misc/exec.whitelist . For examples see: Exec - Bindings | openHAB

Yes, I think so. I used Regex, but if you used JS in the past and it was working, then likely once your script is in the whitelist, it should also work.

Since the title reads „http binding“, you should move the discussion to another thread.

It seems as if this is a limitation in openHAB - is there a chance to get this fixed to be able to continue using the http binding?

Hi Akashkumar, could I ask you to describe step-by-step how you did it? I’m completely new to OH3 so I’m really struggling to get this working. Your help would be greatly appreciated.

Hi all
I have also changed from OH2 to OH3 and am trying to re-integrate my senors. unfortunately without success so far.
could someone please make a small step by step guide on how to get it running again.

already a thank you

regards
Marco