Z-Wave Donge über Netzwerk nutzen?

Begonnen von stenny, 20 Juni 2015, 11:26:45

Vorheriges Thema - Nächstes Thema

mattwire

Danke Sehr!  Jetzt mit ein Kleine Aenderung mehr wird alles funktioniert:

ZWDongle_DoInit:

-  $hash->{STATE} = "Initialized";
+  readingsSingleUpdate($hash, "state", "Initialized", 1);


(Diese Ziel habe ich schon im 00_CUL.pm gesehen)

rudolfkoenig


adb76

Zitat von: rudolfkoenig am 16 Juli 2015, 09:23:32
Habs eingecheckt.

Kann es sein, dass diese Änderung durch die Sourceforge Probleme verloren gegangen ist? Aktuell ist dort die Version $Id: 00_ZWDongle.pm 8964 2015-07-14 12:21:26Z rudolfkoenig $ m. M. ohne diese Änderung in ZWDongle_DoInit.

Gruss,

André

rudolfkoenig

Ja, kann sein, habs jetzt hoffentlich eingecheckt.

mattwire

Hi Rudolf,  I have still been having some problems on restart of fhem.

When fhem restarts the ZWDongle state = Initialized but any commands returns "No FD".  So I detect this state and mark the dongle disconnected.  A get command then attempts a reconnect if disconnected.

This patch fixes it for me: https://github.com/mattwire/fhem-mirror/commit/a2c452ae1fb3022fa7f8de9ad686209172683fb3

rudolfkoenig

This patch is too crude for me. I tested the network connection with
Zitatsocat OPEN:/dev/XXX TCP-LISTEN:12345,reuseaddr,fork
and I could detect no problems, neither by "shutdown restart", nor by aborting and restarting the socat process.

mattwire

Well I am using ser2net on a remote host.  The remote host is not restarting.

It is only happening when I restart fhem, fhem gets in a state where it thinks it has connected but returns "No FD" and is clearly not connected.  To be robust, I think that on detection of "No FD" the state should be set to disconnected at least?  Since that is the actually detected state.

rudolfkoenig

You are right, but AFAIK the "No FD" case can only happen, if DevIo_CloseDev is called, wich sets the state to disconnected, which in turn triggers the check of the peer every 5 seconds. It surely worked in my case.
Can you describe a test scenario on how to reproduce your case?

mattwire

Zitat von: rudolfkoenig am 25 Oktober 2015, 20:15:46
You are right, but AFAIK the "No FD" case can only happen, if DevIo_CloseDev is called
Config: http://forum.fhem.de/index.php/topic,38315.msg307331.html#msg307331

This is happening for me everytime I restart fhem.  Maybe it is some kind of race condition at startup?  By the way I think this problem only appeared after the sourceforge crash.

To improve code reliability shouldn't the "No FD" be handled even if it should never happen?

mattwire

Hallo,

After reading the advice on the wiki page: http://www.fhemwiki.de/wiki/DevelopmentIntroduction#STATE I have changed all hash->{STATE} to readingsVal/readings..Update as per the attached patch.  This simple change seems to have completely solved my network disconnecting/reconnecting issues and has had no reconnect problems for the last two weeks.

If you are happy please commit this change.  (I think the reason was the mixture of different ways to access/change STATE during initialisation was causing the module/fhem to become confused (given the much longer round-trips to communicate over the network).

Thankyou,
Matthew

rudolfkoenig

Thanks, i've made some quick tests and checked it in.