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" }
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
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