Thanks that clarifies it for mepofs wrote:subscription for future zwave binding creation
[HowTo] Send status updates as UDP messages
Re: [HowTo] Send status updates as UDP messages
Re: [HowTo] Send status updates as UDP messages
With the CodeDevice module I did create a toggleButton with a variant of the above code. The message was properly received by the UDPListener at the OpenRemote side. Nice simple test for this communication channel!pofs wrote:It is not very well tested yet, but for sending UDP message you can use the following code:Code: Select all
var sock = new sockets.udp(); sock.sendto("Hello", "192.168.0.1", 1234);
Re: [HowTo] Send status updates as UDP messages
I have updated the Recipe in the first post. Instead of using netcat via a system call, the JS now calls sockets directly. Looks to run faster, but definitely easier to maintain.
Re: [HowTo] Send status updates as UDP messages
Continuation of discussion on: http://www.openremote.org/display/forum ... t-23599520
The next problem I run in to is my Open Remote controller complaining about java classes...
Am I using the wrong version of java for drools?
DEPLOYING NEW CONTROLLER RUNTIME...
--------------------------------------------------------------------
ERROR 2015-06-12 11:07:25,914 : Error in rule definition 'UDPListener.drl' : wrong class format
java.lang.RuntimeException: wrong class format
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:217)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:127)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:183)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2283)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:69)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:266)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:458)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:498)
at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:659)
at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:557)
at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:154)
at org.openremote.controller.service.Deployer.startup(Deployer.java:858)
at org.openremote.controller.service.Deployer.softRestart(Deployer.java:440)
at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1324)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
... 37 more
The next problem I run in to is my Open Remote controller complaining about java classes...
Am I using the wrong version of java for drools?
DEPLOYING NEW CONTROLLER RUNTIME...
--------------------------------------------------------------------
ERROR 2015-06-12 11:07:25,914 : Error in rule definition 'UDPListener.drl' : wrong class format
java.lang.RuntimeException: wrong class format
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:217)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:127)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:183)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2283)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:69)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:266)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:458)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:498)
at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:659)
at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:557)
at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:154)
at org.openremote.controller.service.Deployer.startup(Deployer.java:858)
at org.openremote.controller.service.Deployer.softRestart(Deployer.java:440)
at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1324)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
... 37 more
Re: [HowTo] Send status updates as UDP messages
Actually this question is better dealt with on the OpenRemote forum because I know very little about Java and Drools. Michal Rutka is the best person to answer this question. Sorry to kick you back and forward
My present OR controller is Pro 1.1.1 beta that I got a long time ago from Eric Barieaux. I think this version has not been released yet. My installation is on Synology 212+ where I have Oracle's Java SE Embedded 7.
The UDP rule is the only Drools I still use because that is the only way to communicate UDP {sensor,value}-pairs to OpenRemote. All my other rules have been transformed in Z-Way modules. I have submitted a request to make an adaptation to OpenRemote's UDPListener to accomodate this directly, but on past experience I doubt that will ever be implemented
My present OR controller is Pro 1.1.1 beta that I got a long time ago from Eric Barieaux. I think this version has not been released yet. My installation is on Synology 212+ where I have Oracle's Java SE Embedded 7.
The UDP rule is the only Drools I still use because that is the only way to communicate UDP {sensor,value}-pairs to OpenRemote. All my other rules have been transformed in Z-Way modules. I have submitted a request to make an adaptation to OpenRemote's UDPListener to accomodate this directly, but on past experience I doubt that will ever be implemented
Re: [HowTo] Send status updates as UDP messages
Hello.
Iam testing your code to send out UDP message when a device changes state. My test is on a Fibaro Wall Plug (SwitchBinary.data.level) and i receive UDP message at change so it seems to work as it should. (if i push the button on the device)
But one thing that is troubling me is that if i click the Update button on the Expert user interface for this device then i will recieve a couple of more UDP messages that is telling me the status, and also if i change the state on the device on Expert user interface then i will first receive current state and then the state it was changed to.
Is there a better way to listen for devices that only sends out the changes and not all updates?
Iam testing your code to send out UDP message when a device changes state. My test is on a Fibaro Wall Plug (SwitchBinary.data.level) and i receive UDP message at change so it seems to work as it should. (if i push the button on the device)
But one thing that is troubling me is that if i click the Update button on the Expert user interface for this device then i will recieve a couple of more UDP messages that is telling me the status, and also if i change the state on the device on Expert user interface then i will first receive current state and then the state it was changed to.
Is there a better way to listen for devices that only sends out the changes and not all updates?
Re: [HowTo] Send status updates as UDP messages
I vaguely remember getting many messages in the past. I then fiddled a bit with the Fibaro settings, which reduced the "noise". If I find the time I'll see if I can set up some logging at the receiver end
Re: [HowTo] Send status updates as UDP messages
Thanks.
Of course it would be possible to filter at the receiving end but it would be a much better way to filter them before they go out.
And the best would be if there is a function built in that only trigger when there is a change not on update.
Of course it would be possible to filter at the receiving end but it would be a much better way to filter them before they go out.
And the best would be if there is a function built in that only trigger when there is a change not on update.
Re: [HowTo] Send status updates as UDP messages
I am not advocating such a filter. I only meant to say that I will try to get some logging to see if I can observe what you report. I don't see it in my Z-Way logs
Re: [HowTo] Send status updates as UDP messages
I could try with some other devices to, to see if this is Fibaro specific.
Iam using a simple UDP server that is listening on the port that i set up in the js file, so i am not doing any filtering either.
Edit:
Everspring AN157 have the same issue as my Fibaro Wall Plug.
If i push update in gui then it will trigger one or two UDP messages, and same if i change state with gui.
Iam using a simple UDP server that is listening on the port that i set up in the js file, so i am not doing any filtering either.
Edit:
Everspring AN157 have the same issue as my Fibaro Wall Plug.
If i push update in gui then it will trigger one or two UDP messages, and same if i change state with gui.