Hi all,
I’m not sure if the correct place for my question is here or in the iOS App section of the forum. Sorry if I got it wrong.
My system is: Raspberry Pi 4 with openhabian, OH3.0.1, iOS App version 2.4.20
I have a string item that I want to hold my public IP address to show in a sitemap. The check is triggered manually with a switch item
The items definition:
String Sys_PublicIP "Systme Public IP [%s]" <ip> ["Point"]
Switch Sys_CheckPublicIP "System Public IP Check" <search> ["Point"]
I’m populating the value with the following rule:
val String filename = "system.rules"
rule "Check Public IP"
when
Item Sys_CheckPublicIP received command ON
then
logInfo(filename, "Checking Public IP")
val String currentIP = executeCommandLine(Duration.ofSeconds(15),"dig","+short","myip.opendns.com","@resolver1.opendns.com")
logInfo(filename, "IP is: " + currentIP)
Sys_PublicIP.sendCommand(currentIP)
end
The relevant part of the sitemap:
Text item=Sys_PublicIP label="Public IP [%s]"
Switch item=Sys_CheckPublicIP label="Update Public IP" mappings=[ON="Check"]
Now the problem is that my iOS App doesn’t show the value.
I know the value is correct by checking the logs from the rule and also on every other device the sitemap shows the value correctly.
For example- BasicUI on my PC, checking the value in MainUI, and the android app on another mobile device.
Unless it’s a problem of the iOS App, I think that the problem is connected to the type the currentIP
var get. (That’s why I decided to put it in this section of the forum)
If I simply write something like this, the iOS App shows the value like expected:
Sys_PublicIP.sendCommand("192.168.0.145")
It’s obviously not the correct IP, just put a random string value but of the same “structure”. But any proper string works.
My guess is that I should cast the result of the executeCommandLine
somehow but I can’t figure out the proper way. But then again I might be totally wrong
Any idea would be appreciated.
Thank you all…