THZ Tecalor (LWZ Stiebel Eltron) module support and code improvement.

Begonnen von immi, 02 Februar 2015, 11:42:16

Vorheriges Thema - Nächstes Thema

andre.k

Zitat von: immi am 09 Juli 2017, 16:26:33
1) the heatpump is not multitasking
2) if the heatpump is so busy, that it answers after 2 seconds, sending a second STX  after 0.5 seconds makes only think worse.
can you test your proposed code sending a ETX or EOT after 0.5 seconds?
Other control chars than 0x02 are not responded from heatpump. So I think there is no way to tell the headpump we want to stop the communication. The only (known) handshake is sending 0x02 and wait for the answer 0x10.

TheTrumpeter

Information about active "cooling" is part of sDisplay-message, just add ", ["Cooling: ", 11, 1, "bit3", 1]" at the end of

  "0A0176Dis" => [[" switchingProg: ", 11, 1, "bit0", 1],  [" compressor: ", 11, 1, "bit1", 1],
      [" heatingHC: ", 11, 1, "bit2", 1],  [" heatingDHW: ", 10, 1, "bit0", 1],
      [" boosterHC: ", 10, 1, "bit1", 1],  [" filterBoth: ", 9, 1, "bit0", 1],
      [" ventStage: ", 9, 1, "bit1", 1],  [" pumpHC: ", 9, 1, "bit2", 1],
      [" defrost: ", 9, 1, "bit3", 1],  [" filterUp: ", 8, 1, "bit0", 1],
      [" filterDown: ", 8, 1, "bit1", 1][color=red][b]
],
FHEM auf RPi3, THZ (LWZ404SOL), RPII2C & I2C_MCP342x (ADCPiZero), PowerMap, CustomReadings, RPI_GPIO, Twilight, nanoCUL (WMBus für Diehl Wasserzähler & Regenerationszähler für BWT AqaSmart), ESPEasy, TPLinkHS110

immi

v 0.163 uploaded
- all registers found from TheTrumpeter implemented
- moduleinfo compatibility added

fyi please read here https://forum.fhem.de/index.php/topic,73980.15.html
you can disable sending automatically statistics  (optional)
attr global sendStatistics manually
you can check which statistics are planned to be send to fhem.de without sending them
fheminfo
you can send statistics manually to fhem.de  (optional)
fheminfo send

e.g. in my case, i send following to fhem.de
THZ   4.39t04.39HW74SW2.08   

andre.k

Hi immi,

could you please delete the following line
"sLast10errors" => {cmd2=>"D1", type =>"D1last206", unit =>""},
from %getsonly2xx.

This register 0xD1is not implemented in my firmware 2.14, but probably in 2.06. The line is already in %getsonly206, it should be OK for other 2.06 users.

Concerning my timeout issues I'm about to do some more tests. It could be helpful if we have different timeouts, depending if we wait for an answer from heatpump DLE 0x10 or STX 0x02. DLE is very quick (about 10ms). STX is up to 7700ms in some rare cases.

philipp_b

Hallo Zusammen,

ich bin noch neu bei FHEM und bin auch mit dem Wiki und Anfänger Tips überfordert :(

ich möchte gerne per (Loxone HTTP Befehle) Web Befehl die Volumenströme meiner LWZ504 ändern, aber ich weiß nicht wie ich das definieren muss in FHEM.

Nach dem Beispiel kann ich die Lüfterstufen ändern, aber ich weiß nicht wie man das abändern muss damit ich die Volumenströme einstellen kann.

kann mir da jemand Helfen Bitte?

Gruß
Philipp

immi

Zitat von: philipp_b am 27 Juli 2017, 13:45:50
ich möchte gerne per (Loxone HTTP Befehle) Web Befehl die Volumenströme meiner LWZ504 ändern, aber ich weiß nicht wie ich das definieren muss in FHEM.
Nach dem Beispiel kann ich die Lüfterstufen ändern, aber ich weiß nicht wie man das abändern muss damit ich die Volumenströme einstellen kann.
Hi philipp
no idea how loxone works. If you can change p07FanStageDay, then you should be able to change also
"p37Fanstage1AirflowInlet"  "p38Fanstage2AirflowInlet"     "p39Fanstage3AirflowInlet"     "p40Fanstage1AirflowOutlet"     "p41Fanstage2AirflowOutlet" "p42Fanstage3AirflowOutlet"



Hi Andre
sorry I forgot your request, I will committ it this night
edit: upload done
immi

philipp_b

Vielen Dank, die loxone kann einfache http Befehle senden wie ich es über den webbrowser machen kann.

Da ist mir aufgefallen, dass ich über fhem bei meiner lwz504 die Abluft der Stufe 1 mit minimal 50m3 aber am Geräte Display bis 10m3 einstellen kann. Liegt das am THZ Modul oder kann man  das ändern?
Möchte gerne mir selber eine passivkühlung bauen.

Gruß
Philipp

TheTrumpeter

Zitat von: philipp_b am 29 Juli 2017, 11:46:59
Da ist mir aufgefallen, dass ich über fhem bei meiner lwz504 die Abluft der Stufe 1 mit minimal 50m3 aber am Geräte Display bis 10m3 einstellen kann. Liegt das am THZ Modul oder kann man  das ändern?
Ist im THZ Modul so vorgegeben.
Auch wenn Du am Display der 504er 10m³ einstellen kannst, wird der Wert wirklich übernommen bzw. was steht denn in der Anleitung als Minimalluftstrom?
Ich kann bei meiner 404er am Display teilweise 50m³ einstellen, aber übernommen wird das dann nicht, sondern 80m³, weil das der Mindestvolumenstrom ist.
Zitat von: philipp_b am 29 Juli 2017, 11:46:59Möchte gerne mir selber eine passivkühlung bauen.
Warum verwendest Du nicht die vorhandene Passivkühlungsfunktion?
FHEM auf RPi3, THZ (LWZ404SOL), RPII2C & I2C_MCP342x (ADCPiZero), PowerMap, CustomReadings, RPI_GPIO, Twilight, nanoCUL (WMBus für Diehl Wasserzähler & Regenerationszähler für BWT AqaSmart), ESPEasy, TPLinkHS110

TheTrumpeter

Zitat von: TheTrumpeter am 02 Juli 2017, 20:08:44
0B0264 : sDewPointHC1
immi, would you be so kind and also add the following when you change the module next time?
                    ."interval_sDewPointHC1:0,60,120,180,300 "
FHEM auf RPi3, THZ (LWZ404SOL), RPII2C & I2C_MCP342x (ADCPiZero), PowerMap, CustomReadings, RPI_GPIO, Twilight, nanoCUL (WMBus für Diehl Wasserzähler & Regenerationszähler für BWT AqaSmart), ESPEasy, TPLinkHS110

philipp_b

#579
Die passivkühlung ist mir zu unflexibel, soweit ich verstanden habe wird jeden tag neu die Bedingung der Außentemperatur + 3 grad der Rauminnentemperatur - 3 grad abgefragt. Da ich aber keinen Fühler an der wp angeschlossen habe muss ich mit HK1 Raumtemperatur arbeiten, die bei mir aber im Sommer bei 14 Grad steht, weil sonst die wp ständig anfängt zu läuft...
So würde dann die passivkühlung nie aktiviert.
Zum testen hab ich die Raumtemperatur hochgesetzt, aber bei aktiver passivkühlung wird die Zuluft zu hoch gefahren, so dass sie uns dann zu laut ist.

Die Hz Zahl habe ich nicht kontrolliert, aber die 10m3 werden angenommen  und stehen dann auch in den Einstellungen.

TheTrumpeter

Zitat von: philipp_b am 29 Juli 2017, 12:54:38
Die passivkühlung ist mir zu unflexibel, soweit ich verstanden habe wird jeden tag neu die Bedingung der Außentemperatur + 3 grad der Rauminnentemperatur - 3 grad abgefragt.
Das ist richtig.
Die Passivkühlung bringt ohnehin sehr wenig. Ich habe meine Experimente damit mittlerweile wieder ad acta gelegt.

Zitat von: philipp_b am 29 Juli 2017, 12:54:38
Da ich aber keinen Fühler an der wp angeschlossen habe muss ich mit HK1 Raumtemperatur arbeiten, die bei mir aber im Sommer bei 14 Grad steht, weil sonst die wp ständig anfängt zu läuft...
Gehört zwar nicht hierher, aber: Dann hast Du irgendwas in den Heizparametern gröber falsch eingestellt. Die gefilterte Aussentemperatur fällt bei mir schon den ganzen Sommer über kaum unter 20°C. Da wird nie in den Winterbetrieb geschalten. Kontrollier' mal die Parameter; was Du machst ist ein schlechter Workaround anstatt das Problem wirklich zu lösen.

Zitat von: philipp_b am 29 Juli 2017, 12:54:38
Zum testen hab ich die Raumtemperatur hochgesetzt, aber bei aktiver passivkühlung wird die Zuluft zu hoch gefahren, so dass sie uns dann zu laut ist.
Wenn Du den Parameter Passivkühlung auf "Zulüften" hast, wird die Abluft abgeschaltet und die Zuluft hochgefahren. Diese Einstellung kannst Du aber komplett vergessen, das bringt keinerlei Kühleffekt. Lies dazu meine Untersuchungen mit einem kalibrierten Temperaturfühler an den Lüftungsdüsen.
Du musst den Passivkühlungs-Paramter auf "Ablüften" einstellen, dann funktioniert das genau umgekehrt. Durch die geöffneten Fenster in den Zulufträumen saugst Du die kühle Luft ins Haus.
Der Unterschied bzgl. Luftstrom durch die Fenster ist bei geöffneten Fenstern ggü. deaktivierter Passivkühlung durchaus fühlbar. Allzuviel Unterschied in der resultierenden Raumluft macht es aber nicht.

Zitat von: philipp_b am 29 Juli 2017, 12:54:38
Die Hz Zahl habe ich nicht kontrolliert, aber die 10m3 werden angenommen  und stehen dann auch in den Einstellungen.
Würd' mich interessieren, ob das wirklich funktioniert.
Was sagt die Bedienungsanleitung zum Mindestvolumenstrom?

120m³ sind bei mir gute 20Hz; viel weniger Drehzahl wird überhaupt keinen Druck und damit keinen Luftstrom mehr erzeugen können, deshalb wohl die untere Beschränkung auf 80m³ bei der 404. Würde mich wundern, wenn das bei der 504er anders wäre. Die Physik dahinter ist doch ähnlich.
FHEM auf RPi3, THZ (LWZ404SOL), RPII2C & I2C_MCP342x (ADCPiZero), PowerMap, CustomReadings, RPI_GPIO, Twilight, nanoCUL (WMBus für Diehl Wasserzähler & Regenerationszähler für BWT AqaSmart), ESPEasy, TPLinkHS110

immi

Zitat von: TheTrumpeter am 29 Juli 2017, 12:43:35
immi, would you be so kind and also add the following when you change the module next time?
                    ."interval_sDewPointHC1:0,60,120,180,300 "
done

immi

Dear all
short explanation on the statistics
partecipation to the statistics is optional; expnained here https://forum.fhem.de/index.php/topic,33211.msg657982.html#msg657982
Privacy is very important for me therefore, I want to give complete transparency to what it is happening in the background.

up to now, following data has been collected,which you can find here
https://fhem.de/stats/statistics.html

Model variety for THZ
Model                                  # of installations   
4.39t04.39HW74SW2.08          1   
5.39_05.39HW113SW3.16     1   
n.a._04.19HW73SW2.08           1   
n.a._04.39HW74SW2.08           2   
n.a._05.19HW113SW3.12          1


explanation
4.39t    //   04.39 //    HW74SW2.08   
optional_firmware_attribute // sFirmware // sFirmware-Id

andre.k

Zitat von: immi am 27 Juli 2017, 14:45:23
Hi Andre
sorry I forgot your request, I will committ it this night
edit: upload done
immi
Hi immi,
no problem.

In the meantime I've tested the nonblocking feature for the THZ_Get function, as you already started. This could be a solution for the timeout issues in old firmware. I think this can be generaly useful to make the modul more responsive.

1. I added a new attribute to switch nonblocking on/off
        ."nonblocking:0,1 "

2. some modifications in THZ_GetRefresh. If the attribute nonblocking is set to 1 then the new GetNB function is called in background. Otherwise the normal THZ_Get is called in foreground.

sub THZ_GetRefresh($) {
  my ($par)=@_;
  my $hash=$par->{hash};
  my $command=$par->{command};   
  my $name =$hash->{NAME};
  my $interval = AttrVal($hash->{NAME}, ("interval_".$command), 0);
  #my $replyc = ""; do we need this in background?
  if (AttrVal($name, "nonblocking" , "0")  =~ /1/ ) {
    if (!(exists($hash->{helper}{RUNNING_PID}))) {
      DevIo_CloseDev($hash);          #close device in parent process
      $hash->{helper}{RUNNING_PID} =
             BlockingCall("THZ_GetNB", $name."|".$command, "THZ_GetNBDone", 30, "THZ_GetNBAbort", $hash);
             Log3 $hash, 4, "[$name] THZ_GetRefresh($command) BlockingCall started";
    }
    else {
      Log3 $hash, 3, "[$name] THZ_GetRefresh($command) rescheduled (BlockingCall is still running)";
      InternalTimer(gettimeofday() + 1, "THZ_GetRefresh", $par, 1);
      return;
    }
  }
  else {
    THZ_Get($hash, $hash->{NAME}, $command) if ($hash->{STATE} ne "disconnected");
  }

  if ($interval) {
        $interval = 60 if ($interval < 60); #do not allow intervall <60 sec
        InternalTimer(gettimeofday() + $interval, "THZ_GetRefresh", $par, 1) ;
  }
 
  if ($command =~ "sFirmware") {  # model summary for statistics
        my $sFirmwareId = join('', (split(/ |:/, ReadingsVal($name,"sFirmware-Id"," : : : ")))[0..6]);
        my $sFirmware= (split(/ /, ReadingsVal($name,"sFirmware","  ")))[1];
        $hash->{model}= sprintf("%.5s%s%s", AttrVal($name,"firmware","n.a.")."______", $sFirmware, $sFirmwareId);
  }
}



3. The new functions:
GetNB calls the THZ_Get
GetNBDone to refresh the reading
GetNBAbort kills the child process in case of an error, should never happen.

########################################################################################
#
# THZ_GetNB - NonBlocking Get parameter from heatpump
#
# Parameters: "name | command" (single string)
#
########################################################################################
sub THZ_GetNB($){
  my ($string) = @_;
  my ($name, $cmd) = split("\\|", $string);
  my $hash = $defs{$name};
  my $ret = DevIo_OpenDev($hash, 0, undef);         #open device in child process
  if (defined($ret)) {
    Log3 $hash, 3, "[$name] THZ_GetNB: open device $hash->{DeviceName} error:$ret";
    return ("$name|$cmd|$ret");
  }
  my $msg = THZ_Get($hash, $name, $cmd);
  DevIo_CloseDev($hash);                            #close device in child process
  if ($msg =~ m/\n/m) {                             #error message from get contains \n
    return ("$name|$cmd|[ERROR]");
  }
  else {
    return ("$name|$cmd|$msg");
  }
}


########################################################################################
#
# THZ_GetNBDone - Finish Function
#
# Parameters: "name | command | message" (single string)
#
########################################################################################
sub THZ_GetNBDone($){
  my ($string) = @_;
  my ($name, $cmd, $msg) = split("\\|", $string);
  my $hash = $defs{$name};
  Log3 $hash, 4, "[$name] THZ_GetNBDone: $cmd - $msg";
  if ($msg ne "[ERROR]") {
    readingsSingleUpdate($hash, $cmd, $msg, 1);
  }
  delete($hash->{helper}{RUNNING_PID});
  DevIo_OpenDev($hash, 1, undef);         #reopen device for parent process
}


########################################################################################
#
# THZ_GetNBAbort - Abort Function
#
# Parameter: hash
#
########################################################################################
sub THZ_GetNBAbort($){
  my ($hash) = @_;
  delete($hash->{helper}{RUNNING_PID});
  DevIo_OpenDev($hash, 1, undef);         #reopen device for parent process
  Log3 $hash->{NAME}, 3, "BlockingCall for ".$hash->{NAME}." was aborted";
}



4. The timeout in THZ_ReadAnswer can now be set to greater values. In my case 8 sec in the 2nd SimpleReadWithTimeout

my $buf = DevIo_SimpleReadWithTimeout($hash, 0.25);
$buf = DevIo_SimpleReadWithTimeout($hash, 8) if(!defined($buf)) ; #added for Karl Antwort msg468515


The last modification is in THZ_Parse1 and is not related to nonblocking. I got a lot of perl warnings for non initialized strings in "cmd2"

      foreach  my $cmdhash  (values %gets) {
     if (defined ($cmdhash->{cmd2}) and ($cmdhash->{cmd2} eq $parsingcmd))   #no cmd2 if parent exists in firmware 2.xx
{$msgtype = $cmdhash->{type} ;
last


If you have time could you please test the code in the attached patch.

Andre

immi

Hi Andre
2 problem where holding me back from nonblocking
- continuosly opening and closiing the serial interface (can be an overhead)
- possible collisions

thanks for the contribution; I will have a look this weekend
immi