How to get the wan ip with the exec command binding?

Hi, I have a multiple WAN providers and VPN tunnels and hence would like to check very frequently on the WAN IP address of the openhabian server. I used to do this with the http binding (which stopped to work with the latest openhab upgrade). Hence I would like to do this with the exec binding. I tried the below but didn’t get it to work. The command curl -s https://checkip.amazonaws.com does return the IP address in the cli. Please advise…

wan.items

String WAN_IP "WAN IP Adresse [%s]" { channel="exec:command:checkip:output",autoupdate="true" }

wan.things

thing exec:command:checkip [command="curl -s https://checkip.amazonaws.com %s", interval=60, timeout=10, autorun=true]

wan.rules

    rule "Monitor WAN IP"
when
    Item WAN_IP changed 
then
    // perform any action needed
    val currentState = WAN_IP.state
    if (currentState == "-") {
        logError("MonitorWANIP", "Unable to get WAN IP")
    } else {
        logInfo("MonitorWANIP", "WAN IP changed to: " + currentState)
    }
end

Assuming you are on the most recent release, did you set up a whitelist for the exec binding as described in the release announcement?

I do not use the exec binding but I know there was a whitelist introduced to address security concerns.

yes saw this as well and that’s what I put into exec.whitelist:

curl -s https://checkip.amazonaws.com

You wouldn’t normally want both autorun and interval, but it should do no harm.

But if you’re not using autorun (input channel) you don’t want %s either, which I think is invalid in this context.

What happened? Your rule would give output on any change.
(While diagnosing, I’d change rule trigger to update)
Have you looked in openhab.log ?

thanks, that did it. Here is it:

wan.items

String WAN_IP "WAN IP Adresse [%s]" { channel="exec:command:checkip:output",autoupdate="true" }

wan.things

thing exec:command:checkip [command="curl -s https://checkip.amazonaws.com", interval=60, timeout=10]

wan.rules

    rule "Monitor WAN IP"
when
    Item WAN_IP changed 
then
    // perform any action needed
    val currentState = WAN_IP.state
    if (currentState == "-") {
        logError("MonitorWANIP", "Unable to get WAN IP")
    } else {
        logInfo("MonitorWANIP", "WAN IP changed to: " + currentState)
    }
end

exec.whitelist

curl -s https://checkip.amazonaws.com