I changed it to use JS transformation and it works.
There is still a weird bug somewhere with the previous examples and it is not the site being queried because it works just fine when using JS transformation (and from a browser).
Thing http:url:ip "WanIP" [
baseURL="https://api.ipify.org",
timeout=3000,
refresh=60
] {
Channels:
Type string : wanip "my wan ip" [
stateTransformation="JS:wan_ip.js",
stateExtension="?format=json" ]
}
Might be related to the use of .things files. If you search the forum there are a lot of reports of things not loaded at all or not properly disposed if things-files are edited. I recommend using managed things via UI.
If you encounter the issue again you could increase the binding log level to TRACE and see what exactly is send and received.
The easiest way is to log into the Karaf console and issue the command to change the org.openhab.binding.HTTP (or something like that, you shoudl be able to see in your current logs the name of the logger, it’s in the [ ] after the logging level).
Alternatively you can add a line to the /var/lib/openhab/etc/log4j2.xml to set the logging level for that binding.
Could you share your “wan_ip.js” script code?
I’ve been struggling with HTTP binding on my OH3 for a few days now, it seems I’ve already checked every possible combination and I keep getting a message like
this
Requesting ‘https://123.123.123.123?something’ (method=‘GET’, content=‘null’) failed: Total timeout 3000 ms elapsed
I thought that since you had problems but you solved them and you have a working configuration, I’ll use it at home and check if it works.
If works I’ll know that the code I’m still checking needs tweaking, but if your setup doesn’t work I’ll know it’s some setting issue within OH3 or maybe RPi4.
I will be grateful for your help. I found some related topics but us understood binding has changed for OH3 so they are no more essential for my case.