Closed rdrxr closed 11 months ago
If you take a look at this class: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/IpCameraActions.java
You can see that it takes two arguments: filename and secondsToRecord (String and int) Looks like you are providing an in only, thus getting a no such method exception.
Thx for the fast answer @seaside1 . I am submitting these 2 arguments. Otherwhise IntelliJ would not compile my code and generate the .jar file. As i written, really strange because the sendMail-Action also has multiple arguments and work fine. Sounds for me something with datatypes and reflection?
Ok. Yeah seems like the code is calling the function with a single argument. I don't have any camera to test with, possibly I could use a UniFi camera to test myself, I'll let you know if it works.
You can try to add a virtual generic "RTSP/HTTP IP Camera". I can reproduce in this way. See my attached thing definition example. Just create the thing and add:
JRule with the 2 arguments not works. But this DSL-Rule example works:
getActions("ipcamera", "ipcamera:generic:fc2fa4cd9a").recordMP4(fileName + "_Test",15);
No channel configuration necessary, just ffmpeg must be installed and the video is recorded generic.txt
I have not managed to put that much time into this. But i managed to get a camera up and running with the ipcam binding. One thing I noticed was that the generated JRuleActions.java was messed up after i added the ipcam, could you verify that jruleactions.java looks ok? If so could you post the contents of it?
okey thx. here are my "action" files. For me they look okey. actions.zip
will try to debug on my development system, maybe i can see something there.
Same problem on my development system. It occurs in the JRuleAbstractAction.invokeMethod, already in getClass. All arguments are passed as you can see in screenshot. Maybe something with dependencies or execution context. But here im out, in the Java universe. Maybe someone else has an idea.
Method method = this.thingActions.getClass().getDeclaredMethod(methodName, classes);
I thing the problem could be that IpCameraActions takes int as second parameter. The generated _IpcameraGenericFc2fa4cd9a class will call the method with Integer as second argument. I don't if Java Reflection will find the method that way?
My rule actions are still working with this pull request. @rdrxr You could try this one: https://github.com/seaside1/jrule/suites/19200166344/artifacts/1126013000 (it's the build of the MR)
Thx for the fix @querdenker2k . With #184 its now its working as expected on my dev system. Will tryout this version on my production enverioments, but currently have no other rule actions in use.
Thank you guys!
Not sure if its a Bug. Trying to run the "recordMP4" action from the IPCamera-AddOn. Using the same function with DSL-Rule Engine works without problem! The sendMail action from the Mail-AddOn for example is working fine with JRule.
Tried with the 0.18 also with the 0.19.1 prerelease on OpenHAB 4.0 and OpenHAB 4.1 M4. Maybe someone have an idea? (Java-Beginner)
JRuleActions.ipcameraReolink88866a88666.recordMP4(fileName,15);
023-12-04 19:20:15.049 [ERROR] [on.jrule.internal.engine.JRuleEngine] - [TreppeMotion] Error in rule: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.openhab.automation.jrule.internal.engine.JRuleEngine.invokeRuleInternal(JRuleEngine.java:550) at org.openhab.automation.jrule.internal.engine.JRuleEngine.lambda$62(JRuleEngine.java:515) at org.openhab.automation.jrule.internal.engine.JRuleEngine.invokeDelayed(JRuleEngine.java:574) at org.openhab.automation.jrule.internal.engine.JRuleEngine.lambda$61(JRuleEngine.java:514) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.lang.RuntimeException: method not found at org.openhab.automation.jrule.actions.JRuleAbstractAction.invokeMethod(JRuleAbstractAction.java:44) at org.openhab.automation.jrule.generated.actions._IpcameraReolink9639a79681.recordMP4(_IpcameraReolink9639a79681.java:38) at org.openhab.automation.jrule.rules.user.CamaraRecord.TreppeMotion(CamaraRecord.java:35) ... 13 more Caused by: java.lang.NoSuchMethodException: org.openhab.binding.ipcamera.internal.IpCameraActions.recordMP4(java.lang.String,java.lang.Integer) at java.base/java.lang.Class.getDeclaredMethod(Class.java:2675) at org.openhab.automation.jrule.actions.JRuleAbstractAction.invokeMethod(JRuleAbstractAction.java:41) ... 15 more
target: java.lang.RuntimeException: method not found at org.openhab.automation.jrule.actions.JRuleAbstractAction.invokeMethod(JRuleAbstractAction.java:44) at org.openhab.automation.jrule.generated.actions._IpcameraReolink9639a79681.recordMP4(_IpcameraReolink9639a79681.java:38) at org.openhab.automation.jrule.rules.user.CamaraRecord.TreppeMotion(CamaraRecord.java:35) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.openhab.automation.jrule.internal.engine.JRuleEngine.invokeRuleInternal(JRuleEngine.java:550) at org.openhab.automation.jrule.internal.engine.JRuleEngine.lambda$62(JRuleEngine.java:515) at org.openhab.automation.jrule.internal.engine.JRuleEngine.invokeDelayed(JRuleEngine.java:574) at org.openhab.automation.jrule.internal.engine.JRuleEngine.lambda$61(JRuleEngine.java:514) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.lang.NoSuchMethodException: org.openhab.binding.ipcamera.internal.IpCameraActions.recordMP4(java.lang.String,java.lang.Integer) at java.base/java.lang.Class.getDeclaredMethod(Class.java:2675) at org.openhab.automation.jrule.actions.JRuleAbstractAction.invokeMethod(JRuleAbstractAction.java:41) ... 15 more