Hello all,
I am finalizing the migration from OH2 to OH3, and I am stuck with the following command update:
if (now.millis/1000 - Integer.valueOf(executeCommandLine(“stat -c %Y /dev/shm/teleinfo.txt”,2000)) > 300)
The purpose of this command is to make sure that a file is updated regularly ( 5 minutes / 300 seconds )
This is a try with OH3:
if (now.toInstant().toEpochMilli()/1000 - executeCommandLine(Duration.ofSeconds(2),“stat”,“-c”,“%Y”,“/dev/shm/teleinfo.txt”) > 300)
which return tris error :
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘sam-5’ failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.LongExtensions.operator_minus(long,byte) on instance: null in sam
I also tried to transform the second byte value into long, I get the same error message, only byte is replaced by long…
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘sam-5’ failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.LongExtensions.operator_minus(long,long) on instance: null in sam
I spent two evenings trying various things in java without succeeding, if anyone has an idea I am more than willing.
Thanks a lot
Sam