This page last changed on Oct 16, 2013 by nbewhm4.

I was trying to send a command to an ISY9945 to execute a program. In the designer, the protocol selected was ISY-99, the address was /rest/programs/0003/, and the command was runThen. (http://192.1.2.3/rest/programs/0003/runThen - which runs fine in a browser). However it seems that OR is building a different string - seems its prefixing my address with /rest/nodes, so the command that is sent is /rest/nodes/rest/programs/0003/runThen, which gives a 404 error as it cant find the page.

I tried ../../rest, but that gets sent as /rest/nodes/../../rest which also doesnt work.

Is there a way to modify the prefix and remove the nodes piece or have I done something wrong ?

Thanks in advance.

It seems to be hard-coded.

Do not have an immediate solution for this, and haven't looked at the source in sufficient detail yet to think of how to patch it.

Something for the to-do list but if anyone from the community has ideas/patches to propose, please send them here.

Posted by juha at Oct 22, 2013 20:43

Would be nice if either the UI could select whether or not your were addressing a node or program and pad accordingly, or just let the user pad the code....thoughts?

Posted by nbewhm4 at Oct 30, 2013 02:32

Could make sense, seems reasonable solution.

Unfortunately I won't be able to push this as a priority to fix myself right now. It will have to wait for a later date when I have more time available. I'd appreciate if someone from the community would step up to and look at creating a patch. If you've got Java skills yourself Andrew, let me know.

Posted by juha at Oct 30, 2013 20:36

Old programmer, Cobol, Powerbuilder, VB, Windows API's, a little Java. If someone could spend 10 - 20 min chatting about your source code, version control, where I can find the source code and scripts to build/test etc I could take a look and maybe propose a solution....

Posted by nbewhm4 at Nov 05, 2013 00:51

To get started:

1) Install ant build tool from http://ant.apache.org somewhere in your path (Java build tool, roughly equivalent to make)

2) checkout a stable tag from subversion, e.g.

> svn co https://svn.code.sf.net/p/openremote/code/tags/snapshot/Controller_2_1_0_FM_SNAPSHOT-20130617

(assume svn is already installed somewhere in your path – installation details depends on your operating system/choice of shell)

3) go to the root of the directory you just checked out, there's a file build.xml there. Now type:

> ant

The build will start, you will find the compiled binaries in the /output directory.

The source code you want to start with is in src/org/openremote/controller/protocol/isy99/Isy99Command.java, the hardcoded path in the snippet below:

  // Implements ExecutableCommand -----------------------------------------------------------------

  private String formWriteCommandUrl()
  {
    StringBuilder url = new StringBuilder();
    String effectiveCommand = command;
    String effectiveCommandParam = commandParam;

    // Compensate for the somewhat odd ISY-99 dimming behavior. Using the DON command
    // with 0 as a parameter does not actually cause the device to be turned off. Using
    // the DOF command will, though.
    if (ISY99_ON_COMMAND.equals(command) && commandParam != null)
    {
      if (commandParam.equals("0"))
      {
        effectiveCommand = ISY99_OFF_COMMAND;
        effectiveCommandParam = null;
      }
      else
      {
        effectiveCommandParam = "" + ((Integer.valueOf(commandParam) * ISY99_MAX_DIMMER_VALUE)/100);
      }
    }

    url.append("http://");
    url.append(host);
    url.append("/rest/nodes/");
    url.append(address.replaceAll(" ", "%20"));
    url.append("/cmd/");
    url.append(effectiveCommand);
    if (effectiveCommandParam != null && !effectiveCommandParam.equals(""))
    {
      url.append("/");
      url.append(effectiveCommandParam);
    }

    return url.toString();
  }

The other relevant code is in /src/org/openremote/controller/protocol/isy99/Isy99CommandBuilder.java which is basically driving the parameterization of the former Isy99Command.java – something you'd eventually want to look at once you've managed to check how the modified URLs in the Isy99Command code works. There's some documentation on how these two classes relate to each other here: Developer How To - Adding Your Own Protocol to OpenRemote Boss 2.0 Controller (although some of it may be outdated by now).

If you're a skype user, you can send your contact details to me with id 'juhalindfors' in case you have questions you prefer to cover on chat.

HTH,

Let me know if you need something more.

– Juha

Posted by juha at Nov 05, 2013 16:03

Thanks, I will try and take a look over the holidays.

Posted by nbewhm4 at Dec 18, 2013 14:13

I followed your instructions to build a new version, this is the result from the ant command:
C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617>ant
Buildfile: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build.xml

clean:
delete Deleting directory C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build
delete Deleting directory C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output
delete Deleting directory C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\web\WEB-INF\classes

init:
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\war
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\webapps
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs\dev
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs\knx
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs\onewire
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs\isy99
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\testcontainer\logs\lagarto
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output
copy Copying 40 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\lib
copy Copying 5 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\lib\native

compile:
echo --------------------------------------------------------------------
echo Compiling project classes (full)...
echo --------------------------------------------------------------------
echo
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\classes
copy Copying 13 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\classes
copy Copying 13 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\web\WEB-INF\classes
copy Copying 37 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\classes
javac C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build.xml:302: warning: 'includeantruntime' was not set, defaulting to buil
d.sysclasspath=last; set to false for repeatable builds
javac Compiling 554 source files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\build\classes
javac C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\src\org\openremote\controller\protocol\upnp\UPnPParser.java:29: warning: DO
MParser is internal proprietary API and may be removed in a future release
javac import com.sun.org.apache.xerces.internal.parsers.DOMParser;
javac ^
javac C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\src\org\openremote\controller\protocol\upnp\UPnPParser.java:99: warning: DO
MParser is internal proprietary API and may be removed in a future release
javac DOMParser parser = new DOMParser();
javac ^
javac C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\src\org\openremote\controller\protocol\upnp\UPnPParser.java:99: warning: DO
MParser is internal proprietary API and may be removed in a future release
javac DOMParser parser = new DOMParser();
javac ^
javac Note: Some input files use or override a deprecated API.
javac Note: Recompile with -Xlint:deprecation for details.
javac Note: Some input files use unchecked or unsafe operations.
javac Note: Recompile with -Xlint:unchecked for details.
javac 3 warnings

package:
echo --------------------------------------------------------------------
echo Creating Controller Runtime...
echo --------------------------------------------------------------------
echo
mkdir Created dir: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17
copy Copying 43 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17
copy Copied 20 empty directories to 13 empty directories under C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote
-Controller-2.1.0_SNAPSHOT-2013-06-17
copy Copying 39 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17\
webapps\controller
copy Copied 12 empty directories to 1 empty directory under C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Co
ntroller-2.1.0_SNAPSHOT-2013-06-17\webapps\controller
copy Copying 821 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17
\webapps\controller\WEB-INF\classes
zip Building zip: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17\webapp
s\controller\WEB-INF\lib\zwave.jar
copy Copying 45 files to C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17\
webapps\controller\WEB-INF\lib
zip Building zip: C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617\output\OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17.zip

BUILD SUCCESSFUL
Total time: 1 minute 49 seconds

C:\OpenRemoteSource\Controller_2_1_0_FM_SNAPSHOT-20130617>

I then copied the files over to my test box, and ran the bat file, but I get the following Unsupported major.minor version error. Not sure what to try next to resolve ?

C:\OpenRemote\bin>openremote run
Using CATALINA_BASE: C:\OpenRemote
Using CATALINA_HOME: C:\OpenRemote
Using CATALINA_TMPDIR: C:\OpenRemote\temp
Using JRE_HOME: C:\Program Files\Java\jdk1.6.0_45
Jan 10, 2014 4:26:38 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not fou
nd on the java.library.path: C:\OpenRemote\webapps\controller\WEB-INF\lib\native
Jan 10, 2014 4:26:38 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 10, 2014 4:26:38 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 896 ms
Jan 10, 2014 4:26:38 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 10, 2014 4:26:38 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Jan 10, 2014 4:26:38 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive webconsole.war
Jan 10, 2014 4:27:32 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/controller,J2EEApplication=none,J2EEServe
r=none
Jan 10, 2014 4:27:32 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory controller
java.lang.UnsupportedClassVersionError: org/openremote/controller/bootstrap/servlet/LogInitialization : Unsupported majo
r.minor version 51.0 (unable to load class org.openremote.controller.bootstrap.servlet.LogInitialization)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1851)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1068)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jan 10, 2014 4:27:33 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 10, 2014 4:27:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 54962 ms

Any help much appreciated.

Posted by nbewhm4 at Jan 10, 2014 21:41
Document generated by Confluence on Jun 05, 2016 09:31