Platform information:
- Hardware: Raspberry Pi 3B
- OS: Raspbian Buster
- Java Runtime Environment: Zulu (openjdk version “1.8.0_152”)
- openHAB version: 2.4.0 (Build)
In order to test the exec-binding I use a simple setup:
Item:
String execTestItem {channel="exec:command:execTestThing:input"}
Thing:
Thing exec:command:execTestThing "execThing" [command="sudo /etc/openhab2/scripts/execTestScript.sh %2$s", interval=0, autorun=true, timeout=5, transform="REGEX((.*?))"]
Rule:
rule "rule_exec_test"
when
Time cron "0 * * * * ?" // every minute
then
var Number reading = (nWaterMeterReading.state as DecimalType).floatValue
var String execArgument = String::format("%1$.3f", reading)
execTestItem.sendCommand(execArgument)
logWarn("rule_exec_test", "update Logfile: " + execArgument)
end
This setup basically works, the log files don’t show errors.
With this setup I expect that the data is written to a file every minute when the rule is executed.
When the data is written to a file the logs show this:
2019-09-07 17:50:00.034 [ome.event.ItemCommandEvent] - Item ‘execTestItem’ received command 298,793
2019-09-07 17:50:00.040 [nt.ItemStatePredictedEvent] - execTestItem predicted to become 298,793
2019-09-07 17:50:00.060 [vent.ItemStateChangedEvent] - execTestItem changed from 298,792 to 298,793
==> /var/log/openhab2/openhab.log <==
2019-09-07 17:50:00.037 [WARN ] [marthome.model.script.rule_exec_test] - update Logfile: 298,793
However the data only is written to a file when the item has changed before.
When the item has not changed the file is not updated by the exec-command and the log shows this:
2019-09-07 17:46:00.047 [ome.event.ItemCommandEvent] - Item ‘execTestItem’ received command 298,785
2019-09-07 17:46:00.050 [nt.ItemStatePredictedEvent] - execTestItem predicted to become 298,785
==> /var/log/openhab2/openhab.log <==
2019-09-07 17:46:00.046 [WARN ] [marthome.model.script.rule_exec_test] - update Logfile: 298,785
So how do I force the exec-command to be executed independent of an item change?
Thanks for any help!