Hello,
I have an issue retrieving the voltage from my HAP. I simply want to do the following: if the voltage is lower than 10.8 V, then perform one action; otherwise, perform another action.
The problem comes from the return type, which I can’t convert to make a comparison (ROS 7.18, 7.15.3):
:local health [/system health get 0]
:local volts ($health->"value")
log info message=$volts; <-- return : 11.6
log info message=[:typeof $volts]; <-- return : str
:local volts [:tonum "$volts"];
log info message=$volts; <-- return nothing
log info message=[:typeof $volts]; <-- return : nil
log info message=[:typeof 10.8]; <-- return : ip (why ?)
local alert [:tonum 10.8];
log info message=[:typeof $alert]; <-- return : num
:if ($volts >= $alert) do={
action...
} else={
other action...
}
Thanks for your help !