hektiker1983 / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Fritzbox binding not responding #321

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
openHAB 1.2.0 is connected to a Fritzbox on port 1012.

At midnight, I have the following log entry (showing that the binding is alive):

INFO  o.o.b.f.i.FritzboxBinding[:235] - Connected to FritzBox on a.b.c.d

This is the last log entry concerning the Fritzbox. No events get processed and 
there are no error log entries between midnight and now (16:00 in the 
afternoon).

"netstat" shows, that the Java process has a connection to the Fritzbox on port 
1012. A thread dump shows, that the thread "MonitorThread" is at the line 
"BufferedReader.readLine()":

"Thread-23" daemon prio=10 tid=0x0a1af400 nid=0x3d4c runnable [0xb38b5000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
        - locked <0x8a2725c8> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        - locked <0x8a2725c8> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at org.openhab.binding.fritzbox.internal.FritzboxBinding$MonitorThread.run(FritzboxBinding.java:238)

In this state, a call on the Fritzbox does not trigger anything in openHAB. 
With "tcpdump", I can see, that the Fritzbox is delivering events to openHAB! 
Still, openHAB does not respond any longer to these events.

After having looked at the code, I think that the reason for this behavior 
could be, that the inner loop in "MonitorThread#run()" is not reacting on "line 
= null".

Maybe this inner loop should be changed from 

while(!interrupted) {
    try {
        String line = reader.readLine();
    if(line!=null) {
       MonitorEvent event = parseMonitorEvent(line);

into something like:

while(!interrupted) {
    try {
        String line = reader.readLine();
    if(line==null) {
            // End of stream: Reopen socket
            break;
        }
        MonitorEvent event = parseMonitorEvent(line);

Regards,
Martin

Original issue reported on code.google.com by planetre...@gmail.com on 28 May 2013 at 2:26

GoogleCodeExporter commented 8 years ago
- How long do you use the fritzbox binding?
- What's your model and firmware version?
- You are on stable or an (old) snapshot of openhab 1.2?

I had also this problem when I started using the fritzbox binding - however, 
after the nightly reconnect had been commited there were no problems afterwards.

Original comment by honkton...@gmail.com on 29 May 2013 at 11:08

GoogleCodeExporter commented 8 years ago
The problem was a different one:

The FritzboxBinding received the events from the Fritzbox. However, the item 
definition was invalid, so the FritzboxBinding had no events to publish. 
Unfortunately, openHAB does not display an error message when it parses my 
invalid items file.

The invalid item definition was because of an icon with a dash ("-"). The 
following line works fine:

  Switch Incoming_Call "Ringing" <network>    (Phone)    { fritzbox="inbound" }

This line is invalid because of the dash in the icon name:

  Switch Incoming_Call "Ringing" <network-on> (Phone)    { fritzbox="inbound" }

So you may close this ticket as invalid.

Is it intended, that openHAB does not log an error message if the items file is 
invalid? And is it intended, that icon names with dashes are not working?

Regards,
Martin

Original comment by planetre...@gmail.com on 29 May 2013 at 11:10

GoogleCodeExporter commented 8 years ago
Hi,

> Is it intended, that openHAB does not log an error message if the items file 
is invalid? 

No it isn't, but it's up to the binding developer to log configuration errors 
accordingly. Soo feel free to enter a new enhancement issue for that. Please 
update this issue with the subsequent issue number.

> And is it intended, that icon names with dashes are not working?

no it is not! See http://code.google.com/p/openhab/issues/detail?id=311 which 
is about spaces in icon names. Would be great if you'd enhance comment that 
issue accordingly

Regards,

Thomas E.-E.

Original comment by teichsta on 29 May 2013 at 11:17

GoogleCodeExporter commented 8 years ago
Okay, I will do that. But only next week, because I am on vacation now for the 
long week-end.

Original comment by planetre...@gmail.com on 29 May 2013 at 12:52

GoogleCodeExporter commented 8 years ago
>No it isn't, but it's up to the binding developer to log configuration errors 
accordingly.

There is nothing that can be done in the binding. If the icon contains a dash 
in its name, BindingConfigReader.validateItemType() and 
BindingConfigReader.processBindingConfiguration() don't even get called.

I will post a comment on #331 with a better example (NTP instead of Fritzbox).

Original comment by planetre...@gmail.com on 3 Jun 2013 at 10:00

GoogleCodeExporter commented 8 years ago
I think you can close this issue as invalid, because this is not a problem of 
the fritzbox binding.

Original comment by planetre...@gmail.com on 16 Jun 2013 at 7:02

GoogleCodeExporter commented 8 years ago

Original comment by kai.openhab on 16 Jun 2013 at 7:20