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

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

Vorheriges Thema - Nächstes Thema

immi

Zitat von: houseowner123 am 08 Februar 2015, 14:10:56
today I came across an old posting of last yearIt looks like there's a bug in the implementation: FHEM always reports "setback" while in fact the THZ works in automatic mode.
I can confirm this! Seems like a bug.

maybe we look at different places, therefore please be more specific.
pOpMode supports DAYmode DHWmode automatic emergency manual setback standby
My pOpMode is in automatic: this means HC1 will switch between normal(daymode) and setback according to programHC1xxx

2015-02-08_06:02:20 Mythz sHC1: outsideTemp: -0.1 x08: 0.3 returnTemp: 27.4 integralHeat: 2 flowTemp: 27.7 heatSetTemp: 28.3 heatTemp: 27.4 seasonMode: winter integralSwitch: 101 opMode: setback roomSetTemp: 21.9 x60: 0 x64: 563.2 insideTempRC: 22.8 x72: 0.1 x76: 2255
2015-02-08_14:58:55 Mythz sHC1: outsideTemp: 5.3 x08: -13.7 returnTemp: 25 integralHeat: -3 flowTemp: 25.5 heatSetTemp: 27.3 heatTemp: 25.1 seasonMode: winter integralSwitch: 101 opMode: normal roomSetTemp: 22 x60: 0 x64: 563.2 insideTempRC: 22.7 x72: 0.1 x76: 1333.4

immi

Zitat von: andre.k am 08 Februar 2015, 12:51:55
@Immi: What do you think about using sliders and list boxes for validation of set values:
"p01RoomTempDay:slider,10,0.1,30,1"
or
"p07FanStageDay:0,1,2,3"

This could increase the usability for gui users a little bit.
Andre
Hi Andre
I tried list and slider last year, but on some browser (android) was not working fine.
In 12 monthes, the frontend improved a lot!!... maybe now all issues are gone.
Could you show me just for  "p07FanStageDay:0,1,2,3" show would you like to implement?
---------------------------

How do I validate the parameter before writing? easy I check the interval and I round the data.
set Mythz p99FanStageParty 1.7 will set a 1
set Mythz p99FanStageParty 4.7 will give an error with the allowed intervall

Concernig writing to old heatpump, you have the complexity of seveal parameter in one register.
I think the user should not be able to change more than one parameter in one register at the time.
I was thinking to the following:
1) split all register during reading in single parameters
2) for writing "set Mythz p13GradientHC1 0.3", you know that p13GradientHC1 is in register 05. You read it again completely and overwrite only the bytes involved

I started 2) some weeks ago, at line 614 there is also a reminder on what should be done.
immi

immi

this is what I found during this weekend:

the heatpumps has 4 modi concerning room temperute:
1) room_thermometer not connected and room_display not connected
sGlobal.insideTemp =-60
sHC1.insideTempRC = sHC1.roomSetTemp

2) room_thermometer connected to KTY81 and room_display not connected
sGlobal.insideTemp = resistance between X5-pin5 and X5-pin6 (conversion table of a NXP-KTY81)
sHC1.insideTempRC = sGlobal.insideTemp  + p99RoomThermCorrection

3) room_thermometer not connected  and room_display connected (hypothesis)
sGlobal.insideTemp = -60
sHC1.insideTempRC = room_display remperature

4) room_thermometer connected to KTY81 and room_display connected (hypothesis)
sGlobal.insideTemp = resistance between X5-pin5 and X5-pin6 (conversion table of a NXP-KTY81)
sHC1.insideTempRC = room_display remperature

I cannot reproduce 3 and 4 because I do not have a second display...  someone else has to confirm (connect something //press reset button // wait 3 min. // confirm or write new theory)

some more information of the X5-pin5 and X5-pin6:
open 5V
short 2.5mA
with KTY81 1.1mA and 2.4V
Do not use long cables; do not use twisted cable; do not roll the cable if longer than necessary; move the cable as far as possible from the current supply.
I am still not 100% happy.. but  I see some improvements after following te above simple rules.
I do not have an oscilloscope or a freqanalyzer at home for digging deeper :( 

willybauss

Zitat von: immi am 08 Februar 2015, 15:22:34
maybe we look at different places, therefore please be more specific.
You're completely right. I just looked in the frequent readings sHC1 and sGlobal, but not in pOpMode. Since I don't use any time programs it's obvious that setback never changes to normal.

Please take it as a user error and rate me one step down in next user ranking  ;) .
FHEM auf Raspberry Pi B und 2B; THZ (THZ-303SOL), CUL_HM, TCM-EnOcean, SamsungTV, JSONMETER, SYSMON, OBIS, STATISTICS

andre.k

Zitat von: immi am 08 Februar 2015, 15:53:57
Hi Andre
I tried list and slider last year, but on some browser (android) was not working fine.
In 12 monthes, the frontend improved a lot!!... maybe now all issues are gone.
Could you show me just for  "p07FanStageDay:0,1,2,3" show would you like to implement?
---------------------------

How do I validate the parameter before writing? easy I check the interval and I round the data.
set Mythz p99FanStageParty 1.7 will set a 1
set Mythz p99FanStageParty 4.7 will give an error with the allowed intervall

Concernig writing to old heatpump, you have the complexity of seveal parameter in one register.
I think the user should not be able to change more than one parameter in one register at the time.
I was thinking to the following:
1) split all register during reading in single parameters
2) for writing "set Mythz p13GradientHC1 0.3", you know that p13GradientHC1 is in register 05. You read it again completely and overwrite only the bytes involved

I started 2) some weeks ago, at line 614 there is also a reminder on what should be done.
immi

Hi immi,

here my ideas. First the definition of the set parameter. We need some additional infos concerning the position and the length of the parameter similar to the parsing elements.
my %sets206 = (
    "p01RoomTempDay" => {cmd2=>"17", argMin =>  "10", argMax =>   "30", pos=>[4, 4, "hex", 10], unit =>" °C"},
    "p02RoomTempNight" => {cmd2=>"17", argMin =>  "10", argMax =>   "30", pos=>[8, 4, "hex", 10], unit =>" °C"},
    "p03RoomTempStandby" => {cmd2=>"17", argMin =>  "10", argMax =>   "30", pos=>[12, 4, "hex", 10],  unit =>" °C"},
    "p04DHWsetDayTemp" => {cmd2=>"17", argMin =>  "10", argMax =>   "55", pos=>[16, 4, "hex", 10],  unit =>" °C"},
    "p05DHWsetNightTemp" => {cmd2=>"17", argMin =>  "10", argMax =>   "55", pos=>[20, 4, "hex", 10],  unit =>" °C"},
    "p06DHWsetStandbyTemp" => {cmd2=>"17", argMin =>  "10", argMax =>   "55", pos=>[24, 4, "hex", 10],  unit =>" °C"},
    "p07FanStageDay" => {cmd2=>"17", argMin =>   "0", argMax =>    "3", pos=>[28, 2, "hex", 1],  unit =>""},
    "p08FanStageNight" => {cmd2=>"17", argMin =>   "0", argMax =>    "3", pos=>[30, 2, "hex", 1],  unit =>""},
    "p09FanStageStandby" => {cmd2=>"17", argMin =>   "0", argMax =>    "3", pos=>[32, 2, "hex", 1],  unit =>""},
    "p10RoomTempManual" => {cmd2=>"17", argMin =>  "10", argMax =>   "65", pos=>[34, 4, "hex", 10],  unit =>" °C"},
    "p11DHWSetTempManual" => {cmd2=>"17", argMin =>  "10", argMax =>   "65", pos=>[38, 4, "hex", 10],  unit =>" °C"},
    "p12FANStageManual" => {cmd2=>"17", argMin =>  "0", argMax =>   "3", pos=>[42, 2, "hex", 1],  unit =>""}
);

In the moment I didn't use the sliders. This would be just for convenience and we can add this later. I think we need your check of min/max anyway, because I'm not shure if the slider and listbox definition is only used in the the browser gui or always.
Next the addition I already tested für the THZ_Set(). Inserted after your test for min/max.
#handle write back for old firmware if the attribute 206 is set.
  if((AttrVal($hash->{NAME}, "firmware" , "4.39") eq "2.06")) {

my $pos = $cmdhash->{pos}[0];
my $len = $cmdhash->{pos}[1];
my $dec = $cmdhash->{pos}[3];
my $subst;
Log3 $hash->{NAME}, 3, "write register/pos/arg to THZ: '$cmdHex2/$pos/$arg'";

#read before write the register
$cmdHex2=THZ_encodecommand($cmdHex2, "get");
($err, $msg) = THZ_Get_Comunication($hash,  $cmdHex2);
if (defined($err))     {
Log3 $hash->{NAME}, 5, "THZ_Set: error read register: '$err'";
return ($msg ."\n msg " . $err);
}
Log3 $hash->{NAME}, 3, "answer from THZ: $msg";
$arg *= $dec; #shift the decimal point
if ($len eq "4") {
$subst = sprintf("%04X",$arg);
}
elsif ($len eq "2"){
$subst = sprintf("%02X",$arg);
}
substr($msg, $pos, $len, $subst); # substitute the parameter in the message payload
Log3 $hash->{NAME}, 3, "write to    THZ: $msg";

# write the message to THZ
substr($msg, 0, 2, ""); #remove the checksum from the head of the payload
$cmdHex2=THZ_encodecommand($msg, "set");
($err, $msg) = THZ_Get_Comunication($hash, $cmdHex2);
Log3 $hash->{NAME}, 3, "written     THZ: $msg";
if (defined($err))     {
Log3 $hash->{NAME}, 5, "THZ_Set: error write register: '$err'";
return ($msg ."\n msg " . $err);
}
return $msg;
  } #end 2.06 handling

With these modification I can already set parameter. I still need to modify the THZ_Get() and the THZ_Parse1() to handle single values from multiple value register. I have the following idea:
1) We intruduce an 3rd parameter in THZ_Parse1() with the $cmdhash->{pos}
$msg2 = THZ_Parse1($hash,$msg2,$cmdhash->{pos});
2) If this parameter is defined we use the parsing information from $cmdhash->{pos}
3) If not, the parsing information is searched based on the type of command (the current approach).
What do you think?

Andre

peter456

Zitat von: andre.k am 08 Februar 2015, 12:51:55
Hi Peter,

I'm about to implement an update for the subroutine THZ_Set. There is a significant difference between the 2.x Firmware and the later versions. In version 2.x a single  parameter value has to be written in groups of parameters. For example if you want to change P01 you have to write all parameter from P01 to P12 to the THZ. All parameters from 01 to 12 will be written with the same command 0x17.
So I'm on the way.

Alles klar immi. Sage bescheid wenn ich was testen soll.

andre.k

Zitat von: peter456 am 08 Februar 2015, 17:07:28
Alles klar immi. Sage bescheid wenn ich was testen soll.

Wir melden uns.
Hattest Du Dir eigentlich die anderen Parameter größer als P12 schon mal angesehen? Stimmen die Readings mit denen in Deiner THZ überein?
Andre

immi

Hi Andre
>>In the moment I didn't use the sliders.
good idea; let us think later on frontend.
----------------
your %sets206 is fine for me
writing will not be a big problem; just some small changes in your code.
----------------
the reading change has a big impact.
if we let people read all %sets206, the initialization at the fhem start will take very very long (especially at 9600):
You read 12 times register "17" because each time you purge 85% of the message.
Give me a week to think on it... it is not a small change.
immi

Hi Peter
>>Hattest Du Dir eigentlich die anderen Parameter größer als P12 schon mal angesehen? Stimmen die Readings mit denen in Deiner THZ überein?
andre is right: please test
immi

Hi Willy
I will remember it during your next goal & performance dialogue :)
immi

peter456

Hallo Andre,

im Anhang die Ergebnisse meines Parameterabgleichs. Bei falschen Werten habe ich meine richtigen Parametern in Klammer (gelb markiert) dargestellt. Ich denke die Solar-Parameter brauchen wir nicht zu beachten, da meine LWZ303i keine Solarfunktion hat.

Gruß
Peter

willybauss

Zitat von: immi am 08 Februar 2015, 16:05:55
3) room_thermometer not connected  and room_display connected (hypothesis)
sGlobal.insideTemp = -60
sHC1.insideTempRC = room_display remperature

4) room_thermometer connected to KTY81 and room_display connected (hypothesis)
sGlobal.insideTemp = resistance between X5-pin5 and X5-pin6 (conversion table of a NXP-KTY81)
sHC1.insideTempRC = room_display remperature

I cannot reproduce 3 and 4 because I do not have a second display...  someone else has to confirm (connect something //press reset button // wait 3 min. // confirm or write new theory)
I can confirm 4).
I remember to have disconnected the KTY81 for testing months ago; so I definitely can confirm  3a) (sGlobal.insideTemp = -60) as well.  sHC1.insideTempRC did not yet exist in that point in time; but I'm 99,999% sure that your assumption for 3b) is correct.

I need to mention that the room display has - same as the display inside the THZ -  its own ThermCorrection value. The THZ display's ThermCorrection value (p99) is used to correct the temperature measured between  X5-pin5 and X5-pin6, while the ThermCorrection value of the room display corrects the offset of  the room display. You do not need to take this into account in code, since FHEM reads sHC1.insideTempRC in it's final, already corrected state.
FHEM auf Raspberry Pi B und 2B; THZ (THZ-303SOL), CUL_HM, TCM-EnOcean, SamsungTV, JSONMETER, SYSMON, OBIS, STATISTICS

willybauss

Zitat von: immi am 04 Februar 2015, 16:05:53
Hi Belu, Hi Andre.k
I like both solution a lot.
But, I do not want to update sDisplay too often (e.g. each 30 sec)
What I miss is, an automatic way to update sDisplay before the webpage is generated.
Untill we find it, it makes sense to add a button "refresh"
immi

Today I came across an interresting looking phrase in readingsGroup wiki:

ZitatDie Aktualisierung im Browserfenster geschieht per longpoll und überträgt nur die jeweils geänderten Zellen. Wenn eine readingsGroup in keinem Browserfenster angezeigt wird findet keine longpoll aktualisierung statt.
Is this what you're looking for?
FHEM auf Raspberry Pi B und 2B; THZ (THZ-303SOL), CUL_HM, TCM-EnOcean, SamsungTV, JSONMETER, SYSMON, OBIS, STATISTICS

belu

Guten Morgen Willy,

Das mit der Aktualisierung der User oder Group readings ist klar. Das Problem ist das THZ Modul das ja den Output für die Readings bereit stellen muss. Das hat aktuell einen Intervall und da ist das was Immi nicht möchte. Das THZ Modul soll nur einen Intervall erzeugen wenn jemand eingelogt ist oder halt einen Refresh Button.

andre.k

Zitat von: peter456 am 08 Februar 2015, 22:49:49
Hallo Andre,

im Anhang die Ergebnisse meines Parameterabgleichs. Bei falschen Werten habe ich meine richtigen Parametern in Klammer (gelb markiert) dargestellt. Ich denke die Solar-Parameter brauchen wir nicht zu beachten, da meine LWZ303i keine Solarfunktion hat.

Gruß
Peter

Hallo Peter,

danke fürs testen. Ich habe die Fehler gefunden und werde sie korrigieren. Bei pFAN (Register 01) haben wir aber einen Unterschied zwischen Deiner und meiner Firmware. In meiner 2.14 kann ich die Lüfter bis 250 m3/h einstellen. Dafür genügt ein Datenbyte zum kodieren. In Deiner Firmaware 2.06 kann der wert bis 280 eingestellt werden. Das passt dann nicht mehr in ein Byte. Daher werden vermutlich für jede Einstellung von P37...P42 zwei Bytes in der Payload werwendet. Um das zu verfizieren benötige ich die folgende vollständige Message aus dem Logfile (Dazu musst du das Attribut verbose=5 setzen).2015.02.10 20:30:39 5: Parse message: 4A015A8AC85A8AC8003C003C003C003C00
Andre

peter456

Zitat von: andre.k am 10 Februar 2015, 20:35:10
Hallo Peter,

danke fürs testen. Ich habe die Fehler gefunden und werde sie korrigieren. Bei pFAN (Register 01) haben wir aber einen Unterschied zwischen Deiner und meiner Firmware. In meiner 2.14 kann ich die Lüfter bis 250 m3/h einstellen. Dafür genügt ein Datenbyte zum kodieren. In Deiner Firmaware 2.06 kann der wert bis 280 eingestellt werden. Das passt dann nicht mehr in ein Byte. Daher werden vermutlich für jede Einstellung von P37...P42 zwei Bytes in der Payload werwendet. Um das zu verfizieren benötige ich die folgende vollständige Message aus dem Logfile (Dazu musst du das Attribut verbose=5 setzen).2015.02.10 20:30:39 5: Parse message: 4A015A8AC85A8AC8003C003C003C003C00
Andre

Hallo Andre,
Hier die vollständige Antwort vom Register pFan:
2015.02.10 21:49:19 5: Mythz sending 10
2015.02.10 21:49:19 5: SW: 10
2015.02.10 21:49:19 5: Parse message: F401007300AD00E6007300A300E6003C003C003C003C0000
2015.02.10 21:49:19 5: Message length: 48
2015.02.10 21:49:19 5: Triggering Mythz (1 changes)
2015.02.10 21:49:19 5: Notify loop for Mythz pFan: p37Fanstage1AirflowInlet: 0 p38Fanstage2AirflowInlet: 115 p39Fanstage3AirflowInlet: 0 p40Fanstage1AirflowOutlet: 173 p41Fanstage2AirflowOutlet: 0 p42Fanstage3AirflowOutlet: 230 p43UnschedVent3: 115 p44UnschedVent2: 163 p45UnschedVent1: 230 p46UnschedVent0: 60 p75PassiveCooling: 0
2015.02.10 21:49:19 4: eventTypes: THZ Mythz pFan: p37Fanstage1AirflowInlet: 0 p38Fanstage2AirflowInlet: 115 p39Fanstage3AirflowInlet: 0 p40Fanstage1AirflowOutlet: 173 p41Fanstage2AirflowOutlet: 0 p42Fanstage3AirflowOutlet: 230 p43UnschedVent3: 115 p44UnschedVent2: 163 p45UnschedVent1: 230 p46UnschedVent0: 60 p75PassiveCooling: 0 -> pFan: p37Fanstage1AirflowInlet: .* p38Fanstage2AirflowInlet: .* p39Fanstage3AirflowInlet: .* p40Fanstage1AirflowOutlet: .* p41Fanstage2AirflowOutlet: .* p42Fanstage3AirflowOutlet: .* p43UnschedVent3: .* p44UnschedVent2: .* p45UnschedVent1: .* p46UnschedVent0: .* p75PassiveCooling: .*

Gruß
Peter

NaCkHaYeD

Hi,

bin neu hier, dementsprechend ein paar Fragen/Anmerkungen:

- Gibt es eine Möglichkeit die aktuelle Uhrzeit vom Raspi an die THZ zu senden (Hintergrund: THZ läuft etwas davon)?
- Was ist der Parameter "evuRelease"
- Bei ein paar Diagrammen von euch, sehe ich eine Luftfeuchtigkeit. Welcher Param ist das denn? Ich sehe unter den sGlobal ein relHumidity der bei mir aber immer 0 ist.
- Gibt es einen Parameter, welcher mir sagt, dass der Filter getauscht werden muss?

Ach ja, ich habe eine THZ 403 SOL mit Firmware 4.39

Ansonsten, ich schätze eure Arbeit wirklich sehr. Dank euch kann ich die Prozesswerte auslesen, die Anlage größtenteils elegant bedienen und das beste eine Mail mir senden, wenn wieder der Wodte Differenz Sensor ausgelöst hat.

mfg
Thomas