I have created a php-script which takes commandline arguments, especially a decimalvalue like “0.8” (Notice the decimalpoint, which in my systemlanguage would normally be a comma!)
It is tested when started from the terminal.
When started via a rule with the folowing command: var result=executeCommandLine("php@@/etc/openhab2/scripts/MyScript.php@@0.8",6000)
The php reports an error, however when using it like: var result=executeCommandLine("php@@/etc/openhab2/scripts/MyScript.php@@0,8",6000)
i.e. with the decimal-comma according my languge setting, it is working!
I created a test rule with your executecommandline and a dummy php script with “echo $argv[1]” inside and then in OH rule I just logInfo the var result…everything is working fine both with dot and comma
edit: are you doing some arithmetic operation inside? If you do and you have forced your locale in php, could be the reason.
I posted the complete .php script at the end of the OP in here.
When starting the script from the commandline with “0,8” I get:
Message:
Unable to set data for featureheating.circuits.0.heating.curve and action setCurve and data{"shift":4,"slope":0,8}
Reason: Invalid request payload JSON format
Code: 1
Trace:#0 phar:///etc/openhab2/scripts/Viessmann-Api-1.3.0-SNAPSHOT.phar/src/API/ViessmannAPI.php(127): Viessmann\API\ViessmannAPI->setRawJsonData('heating.circuit...', 'setCurve', '{"shift":4,"slo...')
#1 /etc/openhab2/scripts/SetSlopeAndShift.php(21): Viessmann\API\ViessmannAPI->setCurve('4', '0,8')
#2 {main}
Note: The actual script does take two values (4 and 0.8).
It looks to me as if executeCommandLine “transforms” the second commandline argument from localized 0,8 to 0.8!
No calculation is done (IMHO!) with the value.
The small php script is using another .phar, not created by me. Asking the author is the next step.
But if you know that it’s working with a specific number format, in your script you can convert your arguments with the php function number_format to use it with the phar.
Like this (one decimal and no thousand separator):