Menu

Notification not working

Help
Markus
2011-05-31
2012-12-14
  • Markus

    Markus - 2011-05-31

    Hello!

    First, thanks for the great XML API to get Data from the eid.

    In the current Release 0.0.1.28 you implement the Notification API. So I can receive notify informations after an component changed the value. Maybe a Component named "test01" at gad 0/0/2 switched the value from on to off. So the XML Server should send an notify on port 1028 (default port).

    But it doesn't work. Here a simple linknx.xml file:

    <?xml version="1.0" ?>
    <config>
        <objects>
            <object id="schalter02" gad="0/0/2"  type="1.001">Schalter 02</object>
    
        </objects>
        <services>
      
            <knxconnection url="ip:192.168.100.10" />
            <xmlserver type="inet" port="1028" />
            
        </services>
        
    </config>
    

    So I have a Component called schalter02. I can change the value with <write><object id="schalter02" value="on" /></write> and read with <read>…</read>. Everything works fine.

    So if I try so register a notification for the element. <admin><notification><register id=\"schalter02\"/></notification></admin> I get <admin status="success"/>. So it should work. After changing the value with the write command. The logs of the linKNX shows:

    2011-05-31 12:35:28  KnxConnection: write(gad=0/0/2, buf, len=2)
    2011-05-31 12:35:28  Object: New value on for object schalter02 (type: 1.001)
    2011-05-31 12:35:28  Object: New value off for object schalter02 (type: 1.001)
    2011-05-31 12:35:28  Object: New value on for object schalter02 (type: 1.001)

    The value would be changed, but no notify. I connect with telnet to listen at the port. No result.

    I try to listen with java:

    socket = new Socket("192.168.100.10", 1028);
    
                            Writer writer = new StringWriter();
                            in = socket.getInputStream();
    
                            Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
                            int n;
                            n = reader.read();
                            while ((n = reader.read()) != -1) {
                                if(n == (char)4) {
                                    writer.flush();
                                    System.err.println("Message: " + writer.toString());
                                    writer = new StringWriter();
                                } else {
                                    writer.write(n);
                                }
                            }
    

    No receiving anything. It the Feature not finale or I just had an error in my work flow?

    Regards, Markus

     
  • jef2000

    jef2000 - 2011-05-31

    Hi,

    The notifications come on the same socket on which you send the "<admin><notification><register id="schalter02"/></notification></admin>" command.

    If you use a telnet session on port 1028 to send "<admin><notification><register id="schalter02"/></notification></admin>", just keep the session open and switch the group address on and off. You should see the notification.

    For the java example, I guess you just have to get an output  stream from the socket and send "<admin><notification><register id="schalter02"/></notification></admin>" on it, followed by special character 0x04 before you enter the while  loop

    Jean-François

     
  • Markus

    Markus - 2011-06-01

    Thank you!

    Now I send the notification command and listen at the same port. I received every change <notify id='schalter02>off</notify>.

    Regards, Markus

     
  • knaller

    knaller - 2011-06-22

    Is there a way to do something similar in JavaScript, not Java?

     
  • Markus

    Markus - 2011-06-23

    Every languages that supports sockets is possible.

    Javascript Socket http://code.google.com/p/jsocket/

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.