Exec Binding Help me!

I manage to get the return of a simple bash 'date "order such as:
my Things:
Thing exec:command:Date_jour [command=“date”, interval=15, timeout=5 ]

my Item:
strong textString Date_du_jour “Date: [%s]” { channel=“exec:command:Date_jour:output” }

my exec.whitelist:
cat /sys/class/thermal/thermal_zone0/temp
** /opt/vc/bin/vcgencmd measure_temp**
** date**
the display is correct and gives:

dimanche 19 avril 2020, 09:06:54 (UTC+0200)

I wish to obtain the date in the form: “19/04/2020” so the bash command is: date +%D

I modify to get the return of a simple bash 'date +% D "command such as:

my Things 2:

Thing exec:command:Date_jour2 [command=“date +%D”, interval=15, timeout=5 ]

my Item:
Date_du_jour2 “Date: [%s]” { channel=“exec:command:Date_jour2:output” }

my exec.whitelist:
cat /sys/class/thermal/thermal_zone0/temp
/opt/vc/bin/vcgencmd measure_temp
date +%D

gives an error:
09:14:23.378 [WARN ] [ing.exec.internal.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : 'Conversion = ‘D’'

Thank’ for help

As you can see in the exec binding docs, the % character allows parameter substitution and formatting in your command line.
So it tries to replace %D with something meaningful and fails.

In this case, you want to pass the % through the exec binding unaltered, so you’ll need to escape it. I think that is as simple as %%D

Your Item definition needs to start with a String type keyword.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.