Hello,
a shell script set a variable in oH, but oH will not use this value for calculations.
The value seems correct (i.e.): 5.3
Example Code (the calculation *3 is not the real calculation I willl use later):
var Number RainForecastNextDay = executeCommandLine("/usr/local/mbin/get_rain_forcast_nextday.sh", 2000)
logInfo("irrigation.rules", "Value **AAA** RainForecastNextDay: {}ENDE",RainForecastNextDay )
RainForecastNextDay = RainForecastNextDay * 3
logInfo("irrigation.rules", "Value BBB RainForecastNextDay: {}ENDE",RainForecastNextDay )
Logfile show, that the RainForecastNextDay is set to “5.3”, but the simple calculation in next line (* 3) went wrong:
…
2019-07-11 14:00:08.993 [INFO ] [rthome.model.script.irrigation.rules] - Value AAA RainForecastNextDay: 5.3ENDE
2019-07-11 14:00:08.998 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘automatic irrigation, calculate irrigation time …’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.lib.NumberExtensions.operator_multiply(java.lang.Number,java.lang.Number) on instance: null
If I set the RainForecastNextDay manually:
RainForecastNextDay = 5.3
it works (* 3 etc …) , no error.
How can I use the “value” from the script as a number?