[SOLVED] executeCommandLine - passing parameter

Tags: #<Tag:0x00007f617b182a70> #<Tag:0x00007f617b182070> #<Tag:0x00007f617b181a30>

I’m wondering how to pass a parameter to executeCommandLine.
I want to control brightness of LED by PIGPIO with pigs command (pigs p gpio_number pwm_value). So I created item:

Dimmer LED1 "LED1" <light> (All_lights) {gpio="pin:21"}

and slider in sitemap.
But I’m stuck on my rule, as I’m not sure if PWMValue is passed correctly in executeCommandLine:

rule "LED1 dimmer"
    Item LED1 received command
    val DimmerPercent=LED1.state as DecimalType //Input Level
    val PWMValue=(((DimmerPercent*255).intValue)/100).intValue //Calculating Value for PWM
    executeCommandLine("pigs p 21 {}", PWMValue)

In log viewer there is no info that executeCommandLine happend.

How to pass PWMValue to executeCommandLine correctly?

I changed my code a bit to round the value for PWM and to see what’s happening in LogViewer. But it still doesn’t work

rule "LED1 dimmer"
    Item LED1 received command
    var DimmerPercent=LED1.state as DecimalType //Input Level
    logInfo("demo.rules", "Percent from dimmer " + DimmerPercent)
    var PWMValue=((((DimmerPercent.intValue)*255).intValue)/100).intValue //Calculating Value for PWM
    logInfo("demo.rules", "Value for PWM " + PWMValue)
    executeCommandLine("pigs p 21 {}",PWMValue)
    logInfo("demo.rules", "Command executed")

execCommandLine isn’t shown as executed in LogViewer.

executeCommandLine("pigs p 21 " + PWMValue.toString)

Beware that pigs binary should found from PATH, so normally it’s better use absolute path, e.g. /bin/pigs