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: Blixman am 25 Oktober 2017, 06:58:08
The first thing that is different is the message length, mine is 84, yours is 82.  The value for integralHeat is always '0000'. Maybe x80: 0017 (23) is the value i'm looking for?
Hi Blixman
it looks you understood perfectly how the decoding works.
I already saw different lenghts between older and newer tecalors.
The first versions of 00_THZ.pm crashed for some users, because I was sometimes looking outside a buffer :)

in order to validate your assumption you have to:

1) look at the display of the heatpump and compare it to the reading.
if you are lucky it is in this register, if not you, have to look in the other registers (as you maybe know, there are hundreds).

2) ask tecalor for a documentation

3) if you have a copy of the new service software, you play "man in the middle"

options 1 and 3 got us where we are.
up to now, there wasn't any help from tecalor :(

if you find out a special encoding for 07.59 ,  I can implement it with a dedicated attribute 
immi

Blixman

#646
Hello and thanks to everyone,

i tried to get the service software but the support only said that i have to buy the ISG Module.
But i will not give up.
Right now i am generating an overview of all registers and parameters for
the THZ504 to hopefully implement it in 00_THZ.pm in the future. This is a lot of work.
I also think, that the integralHeat value must be in another register than sHC1.

@immi: I'd like to read register F7, is there a command to read a register which is not yet implemented in 00_THZ.pm? Otherwise i can read it with a terminal program or temporarily change F4 to F7 when getting sHC1.

When there are news, i will post it here.

Blixman


immi

Zitat von: Blixman am 26 Oktober 2017, 08:42:22
@immi: I'd like to read register F7, is there a command to read a register which is not yet implemented in 00_THZ.pm? Otherwise i can read it with a terminal program or temporarily change F4 to F7 when getting sHC1.
look at  code in sub THZ_debugread($)
e.g. edit line 1679
type "get Mythz debug_read_raw_register_slow"
and a file called data.txt is created containing a report of all register you want to look at
this is a usefull function to investigate several hundreds of registers in a batch
immi

andre.k

Hi immi,

I'am actually playing with FTUI and I would like to set some more parameters via the GUI. I added these new set commands for 2.xx firmware. If you have time could you please have a look at the following patch.
--- 00_THZ.pm 2017-11-13 22:46:22.958567457 +0100
+++ 00_THZ.171.pm 2017-11-25 17:33:35.547658427 +0100
@@ -1,8 +1,8 @@
-##############################################
+##############################################
# 00_THZ
# $Id: 00_THZ.pm 15219 2017-10-09 19:01:39Z immi $
# by immi 10/2017
-my $thzversion = "0.171";
+my $thzversion = "0.171a";
# this code is based on the hard work of Robert; I just tried to port it
# http://robert.penz.name/heat-pump-lwz/
########################################################################################
@@ -75,7 +75,7 @@
      [" p46UnschedVent0: ", 28, 4, "hex", 1], [" p75PassiveCooling: ", 32, 2, "hex", 1]
      ],
   "03pxx206" => [["UpTempLimitDefrostEvaporatorEnd: ", 4, 4, "hex", 10],  [" MaxTimeDefrostEvaporator: ", 8, 4, "hex", 1], [" LimitTempCondenserElectBoost: ", 12, 4, "hex", 10],
-       [" LimitTempCondenserDefrostTerm: ", 16, 4, "hex", 10],   [" CompressorRestartDelay: ", 20, 2, "hex", 1], [" MainFanSpeed: ", 22, 2, "hex", 1]
+       [" LimitTempCondenserDefrostTerm: ", 16, 4, "hex", 10],   [" p47CompressorRestartDelay: ", 20, 2, "hex", 1], [" p48MainFanSpeed: ", 22, 2, "hex", 1]
      ],
   "04pxx206" => [["MaxDefrostDurationAAExchenger: ", 4, 2, "hex", 1], [" DefrostStartThreshold: ", 6, 4, "hex", 10], [" VolumeFlowFilterReplacement: ", 10, 4, "hex", 1]
      ],
@@ -88,11 +88,11 @@
      [" p24Hyst4: ", 10, 2, "hex", 10], [" p25Hyst5: ", 12, 2, "hex", 10],   [" p26Hyst6: ", 14, 2, "hex", 10],
      [" p27Hyst7: ", 16, 2, "hex", 10], [" p28Hyst8: ", 18, 2, "hex", 10],   [" p29HystAsymmetry: ", 20, 2, "hex", 1],
      [" p30integralComponent: ", 22, 4, "hex", 1], [" p31MaxBoostStages: ", 26, 2, "hex", 1],   [" MaxHeatFlowTemp: ", 28, 4, "hex", 10],
-       [" p49SummerModeTemp: ", 32, 4, "hex", 10], [" p50SummerModeHysteresis: ", 36, 4, "hex", 10], [" p77OutTempAdjust: ", 40, 4, "hex", 1],
-       [" p78DualModePoint: ", 44, 4, "hex2int", 10], [" p79ReHeatingDelay: ", 48, 2, "hex", 1]
+       [" p49SummerModeTemp: ", 32, 4, "hex", 10], [" p50SummerModeHysteresis: ", 36, 4, "hex", 10], [" p77OutTempFilterTime: ", 40, 4, "hex", 1],
+       [" p78DualModePoint: ", 44, 4, "hex2int", 10], [" p79BoosterTimeoutHC: ", 48, 2, "hex", 1]
      ],
   "07pxx206" => [["p32HystDHW: ", 4, 2, "hex", 10], [" p33BoosterTimeoutDHW: ", 6, 2, "hex", 1], [" p34TempLimitBoostDHW: ", 8, 4, "hex2int", 10],    [" p35PasteurisationInterval: ", 12, 2, "hex", 1],
-       [" p36MaxDurationDHWLoad: ", 14, 2, "hex", 1], [" PasteurisationTemp: ", 16, 4, "hex", 10], [" MaxBoostStagesDHW: ", 20, 2, "hex", 1],
+       [" p36MaxDurationDHWLoad: ", 14, 2, "hex", 1], [" pasteurisationTemp: ", 16, 4, "hex", 10], [" maxBoostStagesDHW: ", 20, 2, "hex", 1],
      [" p84EnableDHWBuffer: ", 22, 2, "hex", 1]
      ],
   "08pxx206" => [["p80EnableSolar: ", 4, 2, "hex", 1], [" p81DiffTempSolarLoading: ", 6, 4, "hex", 10], [" p82DelayCompStartSolar: ", 10, 2, "hex", 1],
@@ -109,16 +109,33 @@
   "0Apxx206" => [["p54MinPumpCycles: ", 4, 2, "hex", 1], [" p55MaxPumpCycles: ", 6, 4, "hex", 1], [" p56OutTempMaxPumpCycles: ", 10, 4, "hex", 10],
      [" p57OutTempMinPumpCycles: ", 14, 4, "hex", 10], [" p58SuppressTempCaptPumpStart: ", 18, 4, "hex", 1]
      ],
-  "0Bpxx206" => [["pHTG1StartTime: ", 4, 4, "hex2time", 1], [" pHTG1EndTime: ", 8, 4, "hex2time", 1], [" pHTG1Weekdays: ", 12, 2, "hex2wday", 1],
-       [" pHTG1Enable: ", 14, 2, "hex", 1], [" pHTG2StartTime: ", 16, 4, "hex2time", 1], [" pHTG2EndTime: ", 20, 4, "hex2time", 1],
-       [" pHTG2Weekdays: ", 24, 2, "hex2wday", 1], [" pHTG2Enable: ", 26, 2, "hex", 1]
+  "0Bpxx206" => [["progHC1StartTime: ", 4, 4, "hex2time", 1], [" progHC1EndTime: ", 8, 4, "hex2time", 1],
+       [" progHC1Monday: ", 13, 1, "bit0", 1], [" progHC1Tuesday: ", 13, 1, "bit1", 1],
+   [" progHC1Wednesday: ", 13, 1, "bit2", 1], [" progHC1Thursday: ", 13, 1, "bit3", 1],
+   [" progHC1Friday: ", 12, 1, "bit0", 1], [" progHC1Saturday: ", 12, 1, "bit1", 1],
+   [" progHC1Sunday: ", 12, 1, "bit2", 1], [" progHC1Enable: ", 14, 2, "hex", 1],
+       [" progHC2StartTime: ", 16, 4, "hex2time", 1], [" progHC2EndTime: ", 20, 4, "hex2time", 1],
+       [" progHC2Monday: ", 25, 1, "bit0", 1], [" progHC2Tuesday: ", 25, 1, "bit1", 1],
+   [" progHC2Wednesday: ", 25, 1, "bit2", 1], [" progHC2Thursday: ", 25, 1, "bit3", 1],
+   [" progHC2Friday: ", 24, 1, "bit0", 1], [" progHC2Saturday: ", 24, 1, "bit1", 1],
+   [" progHC2Sunday: ", 24, 1, "bit2", 1], [" progHC2Enable: ", 26, 2, "hex", 1]
+       ],
+  "0Cpxx206" => [["progDHWStartTime: ", 4, 4, "hex2time", 1], [" progDHWEndTime: ", 8, 4, "hex2time", 1],
+       [" progDHWMonday: ", 13, 1, "bit0", 1], [" progDHWTuesday: ", 13, 1, "bit1", 1],
+   [" progDHWWednesday: ", 13, 1, "bit2", 1], [" progDHWThursday: ", 13, 1, "bit3", 1],
+   [" progDHWFriday: ", 12, 1, "bit0", 1], [" progDHWSaturday: ", 12, 1, "bit1", 1],
+   [" progDHWSunday: ", 12, 1, "bit2", 1], [" progDHWEnable: ", 14, 2, "hex", 1],
      ],
-  "0Cpxx206" => [["pDHWStartTime: ", 4, 4, "hex2time", 1], [" pDHWEndTime: ", 8, 4, "hex2time", 1], [" pDHWWeekdays: ", 12, 2, "hex2wday", 1],
-       [" pDHWEnable: ", 14, 2, "hex", 1],
-       ],
-  "0Dpxx206" => [["pFAN1StartTime: ", 4, 4, "hex2time", 1], [" pFAN1EndTime: ", 8, 4, "hex2time", 1], [" pFAN1Weekdays: ", 12, 2, "hex2wday", 1],
-       [" pFAN1Enable: ", 14, 2, "hex", 1], [" pFAN2StartTime: ", 16, 4, "hex2time", 1], [" pFAN2EndTime: ", 20, 4, "hex2time", 1],
-       [" pFAN2Weekdays: ", 24, 2, "hex2wday", 1], [" pFAN2Enable: ", 26, 2, "hex", 1]
+  "0Dpxx206" => [["progFAN1StartTime: ", 4, 4, "hex2time", 1], [" progFAN1EndTime: ", 8, 4, "hex2time", 1],
+       [" progFAN1Monday: ", 13, 1, "bit0", 1], [" progFAN1Tuesday: ", 13, 1, "bit1", 1],
+   [" progFAN1Wednesday: ", 13, 1, "bit2", 1], [" progFAN1Thursday: ", 13, 1, "bit3", 1],
+   [" progFAN1Friday: ", 12, 1, "bit0", 1], [" progFAN1Saturday: ", 12, 1, "bit1", 1],
+   [" progFAN1Sunday: ", 12, 1, "bit2", 1], [" progFAN1Enable: ", 14, 2, "hex", 1],
+       [" progFAN2StartTime: ", 16, 4, "hex2time", 1], [" progFAN2EndTime: ", 20, 4, "hex2time", 1],
+       [" progFAN2Monday: ", 25, 1, "bit0", 1], [" progFAN2Tuesday: ", 25, 1, "bit1", 1],
+   [" progFAN2Wednesday: ", 25, 1, "bit2", 1], [" progFAN2Thursday: ", 25, 1, "bit3", 1],
+   [" progFAN2Friday: ", 24, 1, "bit0", 1], [" progFAN2Saturday: ", 24, 1, "bit1", 1],
+   [" progFAN2Sunday: ", 24, 1, "bit2", 1], [" progFAN2Enable: ", 26, 2, "hex", 1]
      ],
   "0Epxx206" => [["p59RestartBeforeSetbackEnd: ", 4, 4, "hex", 1]
      ],
@@ -127,10 +144,9 @@
   "10pxx206" => [["p70StartDryHeat: ", 4, 2, "hex", 1], [" p71BaseTemp: ", 6, 4, "hex", 10], [" p72PeakTemp: ", 10, 4, "hex", 10],
      [" p73TempDuration: ", 14, 4, "hex", 1], [" p74TempIncrease: ", 18, 4, "hex", 10]
      ],
-  "16sol" => [["collector_temp: ", 4, 4, "hex2int", 10], [" dhw_temp: ", 8, 4, "hex2int", 10],
-       [" flow_temp: ", 12, 4, "hex2int", 10], [" ed_sol_pump_temp: ", 16, 4, "hex2int", 10],
-       [" x20: ", 20, 4, "hex2int", 1], [" x24: ", 24, 4, "hex2int", 1],
-       [" x28: ", 28, 4, "hex2int", 1], [" x32: ", 32, 2, "hex2int", 1]
+  "16sol" => [["collectorTemp: ", 4, 4, "hex2int", 10], [" dhwTemp: ", 8, 4, "hex2int", 10],
+       [" flowTemp: ", 12, 4, "hex2int", 10], [" edSolPump: ", 16, 2, "hex2int", 1],
+       [" out: ", 26, 4, "raw", 1], [" status: ", 30, 2, "raw", 1]
      ],
   "17pxx206" => [["p01RoomTempDay: ", 4, 4,  "hex",  10], [" p02RoomTempNight: ", 8,  4, "hex", 10],
      [" p03RoomTempStandby: ", 12, 4,  "hex", 10], [" p04DHWsetTempDay: ", 16, 4,  "hex", 10],
@@ -151,49 +167,48 @@
      [" fault2CODE: ", 32, 4, "faultmap", 1], [" fault2TIME: ", 36, 4, "hex2time", 1],  [" fault2DATE: ", 40, 4, "hexdate", 1],
      [" fault3CODE: ", 44, 4, "faultmap", 1], [" fault3TIME: ", 48, 4, "hex2time", 1],  [" fault3DATE: ", 52, 4, "hexdate", 1]
      ],
-  "EEprg206" => [["OpMode: ", 4, 2, "hex", 1], [" ProgStateHC: ", 10, 2, "opmodehc", 1], [" ProgStateDHW: ", 12, 2, "opmodehc", 1],
+  "EEprg206" => [["opMode: ", 4, 2, "opmode2", 1], [" ProgStateHC: ", 10, 2, "opmodehc", 1], [" ProgStateDHW: ", 12, 2, "opmodehc", 1],
      [" ProgStateFAN: ", 14, 2, "opmodehc", 1], [" BaseTimeAP0: ", 16, 8, "hex", 1], [" StatusAP0: ", 24, 2, "hex", 1],
      [" StartTimeAP0: ", 26, 8, "hex", 1], [" EndTimeAP0: ", 34, 8, "hex", 1]
      ],
-  "F3dhw"  => [["dhw_temp: ", 4, 4, "hex2int", 10], [" outside_temp: ", 8, 4, "hex2int", 10],
-       [" dhw_set_temp: ", 12, 4, "hex2int", 10],  [" comp_block_time: ", 16, 4, "hex2int", 1],
-       [" x20: ", 20, 4, "hex2int", 1], [" heat_block_time: ", 24, 4, "hex2int", 1],
-       [" BoosterStage: ", 28, 2, "hex", 1], [" x30: ", 30, 4, "hex", 1],
-       [" opMode: ", 34, 2, "opmodehc", 1], [" x36: ", 36, 4, "hex", 1]
+  "F3dhw"  => [["dhwTemp: ", 4, 4, "hex2int", 10], [" outsideTemp: ", 8, 4, "hex2int", 10],
+       [" dhwSetTemp: ", 12, 4, "hex2int", 10],  [" compBlockTime: ", 16, 4, "hex2int", 1],
+       [" out: ", 20, 4, "raw", 1], [" heatBlockTime: ", 24, 4, "hex2int", 1],
+       [" dhwBoosterStage: ", 28, 2, "hex", 1], [" pasteurisationMode: ", 32, 2, "hex", 1],
+       [" dhwOpMode: ", 34, 2, "opmodehc", 1], [" x36: ", 36, 4, "raw", 1]
        ],
   "F4hc1"  => [["outsideTemp: ", 4, 4, "hex2int", 10], [" x08: ", 8, 4, "hex2int", 10],
      [" returnTemp: ", 12, 4, "hex2int", 10],  [" integralHeat: ", 16, 4, "hex2int", 1],
      [" flowTemp: ", 20, 4, "hex2int", 10], [" heatSetTemp: ", 24, 4, "hex2int", 10],
      [" heatTemp: ", 28, 4, "hex2int", 10], 
      [" seasonMode: ", 38, 2, "somwinmode", 1],    #[" x40: ", 40, 4, "hex2int", 1],
-       [" integralSwitch: ", 44, 4, "hex2int", 1], [" opMode: ", 48, 2, "opmodehc", 1],
+       [" integralSwitch: ", 44, 4, "hex2int", 1], [" hcOpMode: ", 48, 2, "opmodehc", 1],
      #[" x52: ", 52, 4, "hex2int", 1],
      [" roomSetTemp: ", 56, 4, "hex2int", 10],  [" x60: ", 60, 4, "hex2int", 10],
      [" x64: ", 64, 4, "hex2int", 10],  [" insideTempRC: ",     68, 4, "hex2int", 10],
      [" x72: ", 72, 4, "hex2int", 10],  [" x76: ", 76, 4, "hex2int", 10],
      [" onHysteresisNo: ", 32, 2, "hex", 1], [" offHysteresisNo: ", 34, 2, "hex", 1],
-       [" HCBoosterStage: ", 36, 2, "hex", 1]
+       [" hcBoosterStage: ", 36, 2, "hex", 1]
     ],
-  "F4hc1214"  => [["outsideTemp: ", 4, 4, "hex2int", 10], [" x08: ", 8, 4, "hex2int", 10],
+  "F4hc1214"  => [["outsideTemp: ", 4, 4, "hex2int", 10], [" x08: ", 8, 4, "raw", 1],
      [" returnTemp: ", 12, 4, "hex2int", 10],  [" integralHeat: ", 16, 4, "hex2int", 1],
      [" flowTemp: ", 20, 4, "hex2int", 10], [" heatSetTemp: ", 24, 4, "hex2int", 10],
      [" heatTemp: ", 28, 4, "hex2int", 10], 
-       [" seasonMode: ", 38, 2, "somwinmode", 1],    #[" x40: ", 40, 4, "hex2int", 1],
-       [" integralSwitch: ", 44, 4, "hex2int", 1], [" opMode: ", 48, 2, "opmodehc", 1],
-       #[" x52: ", 52, 4, "hex2int", 1],
+       [" seasonMode: ", 38, 2, "somwinmode", 1],
+       [" integralSwitch: ", 44, 4, "hex2int", 1], [" hcOpMode: ", 48, 2, "opmodehc", 1],
      [" roomSetTemp: ", 62, 4, "hex2int", 10],  [" x60: ", 60, 4, "hex2int", 10],
-       [" x64: ", 64, 4, "hex2int", 10],      [" insideTempRC: ",     68, 4, "hex2int", 10],
-       [" x72: ", 72, 4, "hex2int", 10],      [" x76: ", 76, 4, "hex2int", 10],
+       [" x64: ", 64, 4, "raw", 1],      [" insideTempRC: ",     68, 4, "hex2int", 10],
+       [" x72: ", 72, 4, "raw", 1],      [" x76: ", 76, 4, "raw", 1],
      [" onHysteresisNo: ", 32, 2, "hex", 1], [" offHysteresisNo: ", 34, 2, "hex", 1],
-       [" HCBoosterStage: ", 36, 2, "hex", 1]
+       [" hcBoosterStage: ", 36, 2, "hex", 1]
     ],
   "F5hc2"  => [["outsideTemp: ", 4, 4, "hex2int", 10], [" returnTemp: ", 8, 4, "hex2int", 10],
      [" vorlaufTemp: ", 12, 4, "hex2int", 10],  [" heatSetTemp: ", 16, 4, "hex2int", 10],
      [" heatTemp: ", 20, 4, "hex2int", 10], [" stellgroesse: ", 24, 4, "hex2int", 10],
-       [" seasonMode: ", 30, 2, "somwinmode",1], [" opMode: ", 36, 2, "opmodehc", 1]
+       [" seasonMode: ", 30, 2, "somwinmode",1], [" hcOpMode: ", 36, 2, "opmodehc", 1]
     ],
-  "F6sys206" => [["UserSetFanStage: ", 30, 2, "hex", 1], [" UserSetFanRemainingTime: ", 36, 4, "hex", 1],
-       [" LastErrors: ", 4, 8, "hex2error", 1],
+  "F6sys206" => [["userSetFanStage: ", 30, 2, "hex", 1], [" userSetFanRemainingTime: ", 36, 4, "hex", 1],
+       [" lastErrors: ", 4, 8, "hex2error", 1],
       ],
   "FBglob" => [["outsideTemp: ", 8, 4, "hex2int", 10], [" flowTemp: ", 12, 4, "hex2int", 10],
      [" returnTemp: ", 16, 4, "hex2int", 10], [" hotGasTemp: ", 20, 4, "hex2int", 10],
@@ -214,7 +229,7 @@
      [" dewPoint: ", 82, 4, "hex2int", 10],
      [" P_Nd: ", 86, 4, "hex2int", 100], [" P_Hd: ", 90, 4, "hex2int", 100],
      [" actualPower_Qc: ", 94, 8, "esp_mant", 1], [" actualPower_Pel: ", 102, 8, "esp_mant", 1],
-       [" collectorTemp: ", 4,  4, "hex2int", 10], [" insideTemp: ", 32, 4, "hex2int", 10] #, [" x84: ", 84, 4, "donottouch", 1]
+       [" collectorTemp: ", 4,  4, "hex2int", 10], [" insideTemp: ", 32, 4, "hex2int", 10]
      ],
   "FBglob206" => [["outsideTemp: ", 8, 4, "hex2int", 10], [" flowTemp: ", 12, 4, "hex2int", 10],
      [" returnTemp: ", 16, 4, "hex2int", 10],     [" hotGasTemp: ", 20, 4, "hex2int", 10],
@@ -225,17 +240,17 @@
      [" dhwPump: ", 45, 1, "bit1", 1],      [" heatingCircuitPump: ", 45, 1, "bit0", 1],
      [" solarPump: ", 44, 1, "bit2", 1],      [" compressor: ", 44, 1, "bit0", 1],
      [" boosterStage3: ", 44, 1, "bit3", 1],      [" boosterStage2: ", 44, 1, "n.a.", 1],
-       [" boosterStage1: ", 44, 1, "bit1", 1],      [" highPressureSensor: ", 49, 1, "n.a.", 1],
-       [" lowPressureSensor: ", 49, 1, "n.a.", 1],      [" evaporatorIceMonitor: ", 49, 1, "n.a.", 1],
-       [" signalAnode: ", 49, 1, "n.a.", 1],      [" evuRelease: ", 48, 1, "n.a.", 1],
-       [" ovenFireplace: ", 48, 1, "n.a.", 1],      [" STB: ", 48, 1, "n.a.", 1],
-       [" outputVentilatorPower: ",48, 2, "hex", 1],  [" inputVentilatorPower: ", 50, 2, "hex", 1], [" mainVentilatorPower: ", 52, 2, "hex", 1],
+       [" boosterStage1: ", 44, 1, "bit1", 1],      [" highPressureSensor: ", 54, 1, "bit3", 1],
+       [" lowPressureSensor: ", 54, 1, "bit2", 1],      [" evaporatorIceMonitor: ", 55, 1, "bit3", 1],
+       [" signalAnode: ", 54, 1, "bit1", 1],      [" evuRelease: ", 48, 1, "n.a.", 1],
+       [" ovenFireplace: ", 54, 1, "bit0", 1],      [" STB: ", 48, 1, "n.a.", 1],
+       [" outputVentilatorPower: ",48, 2, "hex", 1],  [" inputVentilatorPower: ", 50, 2, "hex", 1], [" mainVentilatorPower: ", 52, 2, "hex", 255/100],
      [" outputVentilatorSpeed: ",56, 2, "hex", 1],     [" inputVentilatorSpeed: ", 58, 2, "hex", 1],  [" mainVentilatorSpeed: ", 60, 2, "hex", 1],
-       [" outside_tempFiltered: ",64, 4, "hex2int", 10], [" relHumidity: ", 70, 4, "n.a.", 1],
+       [" outsideTempFiltered: ",64, 4, "hex2int", 10], [" relHumidity: ", 70, 4, "n.a.", 1],
      [" dewPoint: ", 5, 4, "n.a.", 1],
      [" P_Nd: ", 5, 4, "n.a.", 1],             [" P_Hd: ", 5, 4, "n.a.", 1],
      [" actualPower_Qc: ", 5, 8, "n.a.", 1],         [" actualPower_Pel: ", 5, 8, "n.a.", 1],
-       [" collectorTemp: ", 4,  4, "hex2int", 10],     [" insideTemp: ", 32, 4, "hex2int", 10] #, [" x84: ", 84, 4, "donottouch", 1]
+       [" collectorTemp: ", 4,  4, "hex2int", 10],     [" insideTemp: ", 32, 4, "hex2int", 10]
      ],
   "FCtime" => [["Weekday: ", 5, 1,  "weekday", 1],     [" Hour: ", 6, 2, "hex", 1],
      [" Min: ", 8, 2,  "hex", 1],             [" Sec: ", 10, 2, "hex", 1],
@@ -519,25 +534,118 @@
   

my %sets206 = (
-  "p01RoomTempDay"     => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "30", unit =>" °C"},
-  "p02RoomTempNight" => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "30", unit =>" °C"},
-  "p03RoomTempStandby" => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "30", unit =>" °C"},
-  "p04DHWsetTempDay" => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "55", unit =>" °C"},
-  "p05DHWsetTempNight" => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "55", unit =>" °C"},
-  "p06DHWsetTempStandby"=> {parent=>"p01-p12",      argMin =>  "10", argMax =>  "55", unit =>" °C"},
-  "p07FanStageDay"     => {parent=>"p01-p12",      argMin =>   "0", argMax =>   "3", unit =>""},
-  "p08FanStageNight" => {parent=>"p01-p12",      argMin =>   "0", argMax =>   "3", unit =>""},
-  "p09FanStageStandby" => {parent=>"p01-p12",      argMin =>   "0", argMax =>   "3", unit =>""},
-  "p10HCTempManual"     => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "65", unit =>" °C"},
-  "p11DHWsetTempManual" => {parent=>"p01-p12",      argMin =>  "10", argMax =>  "65", unit =>" °C"},
-  "p12FanStageManual"   => {parent=>"p01-p12",      argMin =>   "0", argMax =>   "3", unit =>""},
-  "p80EnableSolar"      => {parent=>"pSolar",       argMin =>   "0", argMax =>   "1", unit =>""},
-  "pClockDay"           => {parent=>"sTimedate",    argMin =>   "1", argMax =>  "31", unit =>""},
-  "pClockMonth"         => {parent=>"sTimedate",    argMin =>   "1", argMax =>  "12", unit =>""},
-  "pClockYear"          => {parent=>"sTimedate",    argMin =>  "12", argMax =>  "20", unit =>""},
-  "pClockHour"          => {parent=>"sTimedate",    argMin =>   "0", argMax =>  "23", unit =>""},
-  "pClockMinutes"       => {parent=>"sTimedate",    argMin =>   "0", argMax =>  "59", unit =>""}
- );
+  "p01RoomTempDay"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "30", unit =>" °C"},
+  "p02RoomTempNight"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "30", unit =>" °C"},
+  "p03RoomTempStandby"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "30", unit =>" °C"},
+  "p04DHWsetTempDay"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "55", unit =>" °C"},
+  "p05DHWsetTempNight"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "55", unit =>" °C"},
+  "p06DHWsetTempStandby"        => {parent=>"p01-p12",      argMin => "10", argMax =>  "55", unit =>" °C"},
+  "p07FanStageDay"         => {parent=>"p01-p12",      argMin => "0", argMax =>   "3", unit =>""},
+  "p08FanStageNight"         => {parent=>"p01-p12",      argMin => "0", argMax =>   "3", unit =>""},
+  "p09FanStageStandby"         => {parent=>"p01-p12",      argMin => "0", argMax =>   "3", unit =>""},
+  "p10HCTempManual"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "65", unit =>" °C"},
+  "p11DHWsetTempManual"         => {parent=>"p01-p12",      argMin => "10", argMax =>  "65", unit =>" °C"},
+  "p12FanStageManual"           => {parent=>"p01-p12",      argMin => "0", argMax =>   "3", unit =>""},
+  "p13GradientHC1"     => {parent=>"pHeat1", argMin => "0", argMax =>   "5", unit =>""},
+  "p14LowEndHC1"     => {parent=>"pHeat1", argMin => "0", argMax =>  "20", unit =>" K"},
+  "p15RoomInfluenceHC1" => {parent=>"pHeat1", argMin => "0", argMax =>  "10", unit =>""},
+  "p16GradientHC2"     => {parent=>"pHeat1", argMin => "0", argMax =>   "5", unit =>""},
+  "p17LowEndHC2"     => {parent=>"pHeat1", argMin => "0", argMax =>  "10", unit =>" K"},
+  "p18RoomInfluenceHC2" => {parent=>"pHeat1", argMin => "0", argMax =>  "10", unit =>""},
+  "p19FlowProportionHC1" => {parent=>"pHeat1", argMin => "0", argMax => "100", unit =>" %"},
+  "p20FlowProportionHC2" => {parent=>"pHeat1", argMin => "0", argMax => "100", unit =>" %"},
+  "p21Hyst1"     => {parent=>"pHeat2", argMin => "0", argMax =>   "10", unit =>" K"},
+  "p22Hyst2"     => {parent=>"pHeat2", argMin => "0", argMax =>   "10", unit =>" K"},
+  "p23Hyst3"     => {parent=>"pHeat2", argMin => "0", argMax =>    "5", unit =>" K"},
+  "p24Hyst4"     => {parent=>"pHeat2", argMin => "0", argMax =>    "5", unit =>" K"},
+  "p25Hyst5"     => {parent=>"pHeat2", argMin => "0", argMax =>    "5", unit =>" K"},
+  "p29HystAsymmetry" => {parent=>"pHeat2", argMin => "1", argMax =>    "5", unit =>""},
+  "p30integralComponent" => {parent=>"pHeat2", argMin => "10", argMax =>  "999", unit =>" Kmin"},
+  "p32HystDHW"     => {parent=>"pDHW", argMin => "2", argMax =>   "10", unit =>" K"},
+  "p33BoosterTimeoutDHW" => {parent=>"pDHW", argMin => "0", argMax =>  "240", unit =>" min"},
+  "p34TempLimitBoostDHW"    => {parent=>"pDHW", argMin => "-10", argMax =>   "10", unit =>" °C"},
+  "p35PasteurisationInterval"  => {parent=>"pDHW", argMin => "3", argMax =>   "30", unit =>" Tage"},
+  "p36MaxDurationDHWLoad"    => {parent=>"pDHW", argMin => "6", argMax =>   "12", unit =>" h"},
+  "p37Fanstage1AirflowInlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p38Fanstage2AirflowInlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p39Fanstage3AirflowInlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p40Fanstage1AirflowOutlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p41Fanstage2AirflowOutlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p42Fanstage3AirflowOutlet" => {parent=>"pFan", argMin => "60", argMax =>  "250", unit =>" m3/h"},
+  "p43UnschedVent3" => {parent=>"pFan", argMin => "0", argMax =>  "1000", unit =>" min"},
+  "p44UnschedVent2" => {parent=>"pFan", argMin => "0", argMax =>  "1000", unit =>" min"},
+  "p45UnschedVent1" => {parent=>"pFan", argMin => "0", argMax =>  "1000", unit =>" min"},
+  "p46UnschedVent0"         => {parent=>"pFan", argMin => "0", argMax =>  "1000", unit =>" min"},
+  "p47CompressorRestartDelay" => {parent=>"pDefrostEva", argMin => "0", argMax =>  "20", unit =>" min"},
+  "p48MainFanSpeed"         => {parent=>"pDefrostEva", argMin => "0", argMax =>  "100", unit =>" %"},
+  "p49SummerModeTemp" => {parent=>"pHeat2", argMin => "10", argMax =>   "24", unit =>" °C"},
+  "p50SummerModeHysteresis" => {parent=>"pHeat2", argMin => "1", argMax =>    "5", unit =>" K"},
+  "p54MinPumpCycles" => {parent=>"pCircPump", argMin => "1",  argMax =>   "24", unit =>" /Tag"},
+  "p55MaxPumpCycles" => {parent=>"pCircPump", argMin => "25", argMax =>  "288", unit =>" /Tag"},
+  "p56OutTempMaxPumpCycles" => {parent=>"pCircPump", argMin => "0",  argMax =>   "20", unit =>" °C"},
+  "p57OutTempMinPumpCycles" => {parent=>"pCircPump", argMin => "0",  argMax =>   "25", unit =>" °C"},
+  "p58SuppressTempCaptPumpStart"=> {parent=>"pCircPump", argMin => "0",  argMax =>   "120", unit =>" s"},
+  "p75PassiveCooling" => {parent=>"pFan", argMin => "0", argMax =>    "1", unit =>""},
+  "p77OutTempFilterTime" => {parent=>"pHeat2", argMin => "0",  argMax =>   "24", unit =>" h"},
+  "p78DualModePoint" => {parent=>"pHeat2", argMin => "-10", argMax =>   "20", unit =>" °C"},
+  "p79BoosterTimeoutHC" => {parent=>"pHeat2", argMin => "0", argMax =>   "60", unit =>" min"},
+  "p80EnableSolar"              => {parent=>"pSolar",       argMin => "0", argMax =>   "1", unit =>""},
+  "pClockDay"                   => {parent=>"sTimedate",    argMin => "1", argMax =>  "31", unit =>""},
+  "pClockMonth"                 => {parent=>"sTimedate",    argMin => "1", argMax =>  "12", unit =>""},
+  "pClockYear"                  => {parent=>"sTimedate",    argMin => "12", argMax =>  "20", unit =>""},
+  "pClockHour"                  => {parent=>"sTimedate",    argMin => "0", argMax =>  "23", unit =>""},
+  "pClockMinutes"               => {parent=>"sTimedate",    argMin => "0", argMax =>  "59", unit =>""},
+  "progDHWStartTime"            => {parent=>"pDHWProg",     argMin => "00:00",  argMax =>  "23:59", unit =>""}, 
+  "progDHWEndTime"              => {parent=>"pDHWProg",     argMin => "00:00", argMax =>  "23:59", unit =>""},
+  "progDHWEnable"               => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWMonday"               => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWTuesday"              => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWWednesday"            => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWThursday"             => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWFriday"               => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWSaturday"             => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progDHWSunday"               => {parent=>"pDHWProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1StartTime"            => {parent=>"pHeatProg",    argMin => "00:00", argMax =>  "23:59", unit =>""}, 
+  "progHC1EndTime"              => {parent=>"pHeatProg",    argMin => "00:00", argMax =>  "23:59", unit =>""},
+  "progHC1Enable"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Monday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Tuesday"              => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Wednesday"            => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Thursday"             => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Friday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Saturday"             => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC1Sunday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2StartTime"            => {parent=>"pHeatProg",    argMin => "00:00", argMax =>  "23:59", unit =>""}, 
+  "progHC2EndTime"              => {parent=>"pHeatProg",    argMin => "00:00", argMax =>  "23:59", unit =>""},
+  "progHC2Enable"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Monday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Tuesday"              => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Wednesday"            => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Thursday"             => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Friday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Saturday"             => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progHC2Sunday"               => {parent=>"pHeatProg",    argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1StartTime"           => {parent=>"pFanProg",     argMin => "00:00", argMax =>  "23:59", unit =>""}, 
+  "progFAN1EndTime"             => {parent=>"pFanProg",     argMin => "00:00", argMax =>  "23:59", unit =>""},
+  "progFAN1Enable"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Monday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Tuesday"             => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Wednesday"           => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Thursday"            => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Friday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Saturday"            => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN1Sunday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2StartTime"           => {parent=>"pFanProg",     argMin => "00:00", argMax =>  "23:59", unit =>""}, 
+  "progFAN2EndTime"             => {parent=>"pFanProg",     argMin => "00:00", argMax =>  "23:59", unit =>""},
+  "progFAN2Enable"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Monday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Tuesday"             => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Wednesday"           => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Thursday"            => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Friday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Saturday"            => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""},
+  "progFAN2Sunday"              => {parent=>"pFanProg",     argMin => "0", argMax =>  "1", unit =>""}
+);

my %setsonly214 = (
   "ResetErrors" => {cmd2=>"F8",     argMin =>   "0", argMax =>  "0", type =>"0clean",  unit =>""}
@@ -594,7 +702,6 @@
%getsonly539=(%getsonly539, %getsonly439);

my %getsonly2xx = (
-  "pExpert"     => {cmd2=>"02", type =>"02pxx206", unit =>""},
   "pDefrostEva" => {cmd2=>"03", type =>"03pxx206", unit =>""},
   "pDefrostAA" => {cmd2=>"04", type =>"04pxx206", unit =>""},
   "pHeat1"     => {cmd2=>"05", type =>"05pxx206", unit =>""},
@@ -615,9 +722,15 @@
   "sHC2"     => {cmd2=>"F5", type =>"F5hc2",    unit =>""},
   "sSystem"     => {cmd2=>"F6", type =>"F6sys206", unit =>""},
   "sHistory" => {cmd2=>"09", type =>"09his206", unit =>""},
- # "sLast10errors" => {cmd2=>"D1", type =>"D1last206", unit =>""},   removed  after andres hint; 33211.msg658108
-  "sGlobal"       => {cmd2=>"FB", type =>"FBglob206", unit =>""},  #allFB
+  "sGlobal"       => {cmd2=>"FB", type =>"FBglob206", unit =>""},
   "sTimedate" => {cmd2=>"FC", type =>"FCtime206", unit =>""},
+  "inputVentilatorSpeed"=> {parent=>"sGlobal", unit =>" %"},
+  "outputVentilatorSpeed"=> {parent=>"sGlobal", unit =>" %"},
+  "mainVentilatorSpeed" => {parent=>"sGlobal", unit =>" %"},
+  "inputVentilatorPower"=> {parent=>"sGlobal", unit =>" %"},
+  "outputVentilatorPower"=> {parent=>"sGlobal", unit =>" %"},
+  "mainVentilatorPower" => {parent=>"sGlobal", unit =>" %"},

  );
my %getsonly206 = (
   "sHC1"     => {cmd2=>"F4", type =>"F4hc1",    unit =>""},
@@ -628,18 +741,25 @@
  );
my %getsonly214 = (
   "pFan"          => {cmd2=>"01", type =>"01pxx214", unit =>""},
+  "pExpert"     => {cmd2=>"02", type =>"02pxx206", unit =>""},
+  "sControl"  => {cmd2=>"F2", type =>"F2type", unit =>""},
   "sHC1"     => {cmd2=>"F4", type =>"F4hc1214",    unit =>""},
+  "sLVR"  => {cmd2=>"E8", type =>"E8tyype", unit =>""},
+  "sF0"  => {cmd2=>"F0", type =>"F0type", unit =>""},
+  "sF1"  => {cmd2=>"F1", type =>"F1type", unit =>""},
+  "sEF"  => {cmd2=>"EF", type =>"EFtype", unit =>""},
  );


my %sets=(%sets439539common, %sets439only);
my %gets=(%getsonly439, %sets);
my %OpMode = ("1" =>"standby", "11" => "automatic", "3" =>"DAYmode", "4" =>"setback", "5" =>"DHWmode", "14" =>"manual", "0" =>"emergency");   
+my %opMode2 = ("0" =>"manual", "1" => "automatic");
my %Rev_OpMode = reverse %OpMode;
my %OpModeHC = ("1" =>"normal", "2" => "setback", "3" =>"standby", "4" =>"restart", "5" =>"restart");
my %SomWinMode = ( "01" =>"winter", "02" => "summer");
my %weekday = ( "0" =>"Monday", "1" => "Tuesday", "2" =>"Wednesday", "3" => "Thursday", "4" => "Friday", "5" =>"Saturday", "6" => "Sunday" );
-my %weekdaymap = ( "1" =>"Mon", "2" => "Tue", "3" =>"Wed", "4" => "Thu", "5" => "Fri", "6" =>"Sat", "7" => "Sun" );
+#my %weekdaymap = ( "1" =>"Mon", "2" => "Tue", "3" =>"Wed", "4" => "Thu", "5" => "Fri", "6" =>"Sat", "7" => "Sun" );
my %faultmap = ( "0" =>"n.a.", "1" => "F01_AnodeFault", "2" => "F02_SafetyTempDelimiterEngaged", "3" => "F03_HighPreasureGuardFault", "4" => "F04_LowPreasureGuardFault", "5" => "F05_OutletFanFault", "6" => "F06_InletFanFault", "7" => "F07_MainOutputFanFault", "11" => "F11_LowPreasureSensorFault", "12"=> "F12_HighPreasureSensorFault", "15" => "F15_DHW_TemperatureFault",  "17" => "F17_DefrostingDurationExceeded", "20" => "F20_SolarSensorFault", "21" => "F21_OutsideTemperatureSensorFault", "22" => "F22_HotGasTemperatureFault", "23" => "F23_CondenserTemperatureSensorFault", "24" => "F24_EvaporatorTemperatureSensorFault", "26" => "F26_ReturnTemperatureSensorFault", "28" => "F28_FlowTemperatureSensorFault", "29" => "F29_DHW_TemperatureSensorFault", "30" => "F30_SoftwareVersionFault", "31" => "F31_RAMfault", "32" => "F32_EEPromFault", "33" => "F33_ExtractAirHumiditySensor", "34" => "F34_FlowSensor", "35" => "F35_minFlowCooling", "36" => "F36_MinFlowRate", "37" => "F37_MinWaterPressure", "40" => "F40_FloatSwitch", "50" => "F50_SensorHeatPumpReturn", "51" => "F51_SensorHeatPumpFlow",  "52" => "F52_SensorCondenserOutlet" );
my $firstLoadAll = 0;
my $noanswerreceived = 0;
@@ -1029,7 +1372,18 @@
   
   $arg *= $dec if ($dec != 1);
   $arg  = time2quaters($arg) if ($parsingtype eq "quater");
-  $arg  = substr((sprintf(("%0".$len."X"), $arg)), (-1*$len)); #04X converts to hex and fills up 0s; for negative, it must be trunckated.
+  if ($parsingtype eq "hex2time"){ # only in firmware 2.x
+ my ($hour, $min) = split(':', $arg);
+ $arg = $hour * 100 + $min;
+  }
+  if ($parsingtype =~ /bit(\d)/) { # only in firmware 2.x
+ my $bits = unpack('b4', pack('h1', substr($msg, $pos, 1))); #convert nibble to bit string for example '1111'
+ substr($bits, $1, 1, $arg); #set or unset bit
+ $arg = uc(unpack('h1', pack('b4', $bits))); #convert to nibble
+  }
+  else {
+    $arg  = substr((sprintf(("%0".$len."X"), $arg)), (-1*$len)); #04X converts to hex and fills up 0s; for negative, it must be trunckated.
+  }
   substr($msg, $pos, $len, $arg);
 
   if (defined($arg1))  { #only in case of "8party" or "7prog"
@@ -1381,7 +1741,7 @@
   return (sprintf("%02X", ($checksum %256)));
}

-#####################################
+############### ######################
#
# hex2int - convert from hex to int with sign 16bit
#
@@ -1643,10 +2003,12 @@
       elsif ($Type eq "swver") {$value= sprintf("%01u.%02u", hex(substr($value, 0,2)), hex(substr($value, 2,2)));}
       elsif ($Type eq "hex2ascii") {$value= uc(pack('H*', $value));}
       elsif ($Type eq "opmode") {$value= $OpMode{hex($value)};}
+      elsif ($Type eq "opmode2") {$value= $opMode2{hex($value)};}
       elsif ($Type eq "opmodehc") {$value= $OpModeHC{hex($value)};}
       elsif ($Type eq "esp_mant") {$value= sprintf("%.3f", unpack('f', pack( 'L',  reverse(hex($value)))));}
       elsif ($Type eq "somwinmode") {$value= $SomWinMode{($value)};}
-      elsif ($Type eq "hex2wday") {$value= bitmap2string(unpack('b7', pack('H*',$value)), \%weekdaymap);}
+#      elsif ($Type eq "hex2wday") {$value= bitmap2string(unpack('b7', pack('H*',$value)), \%weekdaymap);}
+      elsif ($Type eq "raw") {;}
       elsif ($Type eq "hex2error") {$value= bitmap2string(unpack('b32', pack('H*',$value)), \%faultmap);}
       elsif ($Type eq "weekday") {$value= $weekday{($value)};}
       elsif ($Type eq "faultmap") {$value= $faultmap{(hex($value))};}


I modified TZH_Set a little bit and I don't want to use parsingtype "hex2wday" anymore.
Furthermore I renamed some strings in sSol and sDHW to camelCase standard.
Do you know perltidy? What do you think about code beautifying?

immi

Hi Andre
>> Do you know perltidy?
I will have a look....thanks

Concerning your patch
would you be so nice to give me one example for "bit" and for "hex2time"?
just run set with verbose 5
I would like to  documents what they are for.
immi


andre.k

Hi immi,

the bit0..4 parsingtype is to set/reset single bits, which is used to program the weekdays in FAN/DHW/HC programs, for example:

set myWP progHC2Monday 1

2017.11.26 16:49:09 5: searching for parent; parenthash= HASH(0x1a16b20), parent = pHeatProg, cmdHex2 = 0B 
2017.11.26 16:49:09 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:49:09 5: myWP sending 02
2017.11.26 16:49:09 5: SW: 02
2017.11.26 16:49:09 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:09 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:09 5: myWP sending 01000C0B1003
2017.11.26 16:49:09 5: SW: 01000C0B1003
2017.11.26 16:49:09 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:09 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:09 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:09 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:49:09 5: myWP sending 10
2017.11.26 16:49:09 5: SW: 10
2017.11.26 16:49:09 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:09 5: double read 1 activated 0100A30B07D00258
2017.11.26 16:49:09 5: double read 1 result with buf1  0100A30B07D002587F010393044C00001003
2017.11.26 16:49:09 5: THZ_ReadAnswer: uc unpack: '0100A30B07D002587F010393044C00001003'
2017.11.26 16:49:09 5: myWP sending 10
2017.11.26 16:49:09 5: SW: 10
2017.11.26 16:49:09 5: read before write from THZ: 0B07D002587F010393044C0000
2017.11.26 16:49:10 5: write command (parsed element/pos/len/dec/parsingtype): 12 / 23 / 1 / 1 / bit0
2017.11.26 16:49:10 5: THZ_Set: 'progHC2Monday 1 0B07D002587F010393044C0100' ... Check if port is open. State = '(opened)'
2017.11.26 16:49:10 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:49:10 4: THZ_Get_Comunication: loop 1
2017.11.26 16:49:10 5: myWP sending 02
2017.11.26 16:49:10 5: SW: 02
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:10 5: myWP sending 0180240B07D002587F010393044C01001003
2017.11.26 16:49:10 5: SW: 0180240B07D002587F010393044C01001003
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:49:10 5: myWP sending 10
2017.11.26 16:49:10 5: SW: 10
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '01808C0B1003'
2017.11.26 16:49:10 5: myWP sending 10
2017.11.26 16:49:10 5: SW: 10
2017.11.26 16:49:10 5: THZ_Get: Try to get 'progHC2Monday'
2017.11.26 16:49:10 5: THZ_Get: Try to get 'pHeatProg'
2017.11.26 16:49:10 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:49:10 5: myWP sending 02
2017.11.26 16:49:10 5: SW: 02
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:10 5: myWP sending 01000C0B1003
2017.11.26 16:49:10 5: SW: 01000C0B1003
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:49:10 5: myWP sending 10
2017.11.26 16:49:10 5: SW: 10
2017.11.26 16:49:10 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:49:10 5: double read 1 activated 0100A40B07D00258
2017.11.26 16:49:10 5: double read 1 result with buf1  0100A40B07D002587F010393044C01001003
2017.11.26 16:49:10 5: THZ_ReadAnswer: uc unpack: '0100A40B07D002587F010393044C01001003'
2017.11.26 16:49:10 5: myWP sending 10
2017.11.26 16:49:10 5: SW: 10
2017.11.26 16:49:10 5: Parse message: A40B07D002587F010393044C0100
2017.11.26 16:49:10 5: Message length: 28
2017.11.26 16:49:10 5: THZ_split: 1 --- progHC1StartTime: 20:00 progHC1EndTime: 06:00 progHC1Monday: 1 progHC1Tuesday: 1 progHC1Wednesday: 1 progHC1Thursday: 1 progHC1Friday: 1 progHC1Saturday: 1 progHC1Sunday: 1 progHC1Enable: 1 progHC2StartTime: 09:15 progHC2EndTime: 11:00 progHC2Monday: 1 progHC2Tuesday: 0 progHC2Wednesday: 0 progHC2Thursday: 0 progHC2Friday: 0 progHC2Saturday: 0 progHC2Sunday: 0 progHC2Enable: 0


The hex2time is used for the start and end time in the programs:
2017.11.26 16:46:39 5: searching for parent; parenthash= HASH(0x1a16b20), parent = pHeatProg, cmdHex2 = 0B 
2017.11.26 16:46:39 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:46:39 4: THZ_Get_Comunication: loop 1
2017.11.26 16:46:39 5: myWP sending 02
2017.11.26 16:46:39 5: SW: 02
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:39 5: myWP sending 01000C0B1003
2017.11.26 16:46:39 5: SW: 01000C0B1003
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:46:39 5: myWP sending 10
2017.11.26 16:46:39 5: SW: 10
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: double read 1 activated 0100F80B07D00258
2017.11.26 16:46:39 5: double read 1 result with buf1  0100F80B07D002587F0103E8044C00001003
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '0100F80B07D002587F0103E8044C00001003'
2017.11.26 16:46:39 5: myWP sending 10
2017.11.26 16:46:39 5: SW: 10
2017.11.26 16:46:39 5: read before write from THZ: 0B07D002587F0103E8044C0000
2017.11.26 16:46:39 5: write command (parsed element/pos/len/dec/parsingtype): 10 / 14 / 4 / 1 / hex2time
2017.11.26 16:46:39 5: THZ_Set: 'progHC2StartTime 0393 0B07D002587F010393044C0000' ... Check if port is open. State = '(opened)'
2017.11.26 16:46:39 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:46:39 4: THZ_Get_Comunication: loop 1
2017.11.26 16:46:39 5: myWP sending 02
2017.11.26 16:46:39 5: SW: 02
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:39 5: myWP sending 0180230B07D002587F010393044C00001003
2017.11.26 16:46:39 5: SW: 0180230B07D002587F010393044C00001003
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:39 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:39 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:46:40 5: myWP sending 10
2017.11.26 16:46:40 5: SW: 10
2017.11.26 16:46:40 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '01808C0B1003'
2017.11.26 16:46:40 5: myWP sending 10
2017.11.26 16:46:40 5: SW: 10
2017.11.26 16:46:40 5: THZ_Get: Try to get 'progHC2StartTime'
2017.11.26 16:46:40 5: THZ_Get: Try to get 'pHeatProg'
2017.11.26 16:46:40 5: THZ_Get_Comunication: Check if port is open. State = '(opened)'
2017.11.26 16:46:40 4: THZ_Get_Comunication: loop 1
2017.11.26 16:46:40 5: myWP sending 02
2017.11.26 16:46:40 5: SW: 02
2017.11.26 16:46:40 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:40 5: myWP sending 01000C0B1003
2017.11.26 16:46:40 5: SW: 01000C0B1003
2017.11.26 16:46:40 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '10'
2017.11.26 16:46:40 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '02'
2017.11.26 16:46:40 5: myWP sending 10
2017.11.26 16:46:40 5: SW: 10
2017.11.26 16:46:40 5: myWP start Function THZ_ReadAnswer
2017.11.26 16:46:40 5: double read 1 activated 0100A30B07D002587F
2017.11.26 16:46:40 5: double read 1 result with buf1  0100A30B07D002587F010393044C00001003
2017.11.26 16:46:40 5: THZ_ReadAnswer: uc unpack: '0100A30B07D002587F010393044C00001003'
2017.11.26 16:46:40 5: myWP sending 10
2017.11.26 16:46:40 5: SW: 10
2017.11.26 16:46:40 5: Parse message: A30B07D002587F010393044C0000
2017.11.26 16:46:40 5: Message length: 28
2017.11.26 16:46:40 5: THZ_split: 09:15 --- progHC1StartTime: 20:00 progHC1EndTime: 06:00 progHC1Monday: 1 progHC1Tuesday: 1 progHC1Wednesday: 1 progHC1Thursday: 1 progHC1Friday: 1 progHC1Saturday: 1 progHC1Sunday: 1 progHC1Enable: 1 progHC2StartTime: 09:15 progHC2EndTime: 11:00 progHC2Monday: 0 progHC2Tuesday: 0 progHC2Wednesday: 0 progHC2Thursday: 0 progHC2Friday: 0 progHC2Saturday: 0 progHC2Sunday: 0 progHC2Enable: 0


immi


immi

Hi Andre
I implemented the 2 functions in a different way
would you be so nice to xcheck before I committ the file enclosed?
thanks
immi

code hier

  $arg  = time2quaters($arg)                                    if ($parsingtype eq "quater");
  $arg= join('', (split(':', $arg)))                            if ($parsingtype eq "hex2time"); # only in firmware 2.x
  #$arg= eval(join('*100+', (split(':', $arg)))) if ($parsingtype eq "hex2time"); #just in case the above does not work
  $arg=(hex(substr($msg, $pos, 1)) & (15-2**$1)) | (2**$1*$arg) if ($parsingtype =~ /bit(\d)/);
  $arg  = substr((sprintf(("%0".$len."X"), $arg)), (-1*$len)); #04X converts to hex and fills up 0s; for negative, it must be trunckated.
  substr($msg, $pos, $len, $arg);




andre.k

Hi immi,

ZitatI implemented the 2 functions in a different way

I see, you like as much as possible in one single line ;)

The first implementaion of "hex2time" is a little bit dangerous. What if minutes<10? But we need min/max parameter checking for hex2time anyway. I would move this part in the parameter checking block.
my $cmdcode = $cmdhash->{cmd2};
my $cmdtype = $cmdhash->{type};
my $msgtype = $cmdhash->{type};
my $argMax = $cmdhash->{argMax};
my $argMin = $cmdhash->{argMin};
my $parent = $cmdhash->{parent};
my $i = 0;
my $parsingrule = $parsinghash{$msgtype} if(defined($msgtype));
if (defined($parent)) {
Log3 $hash->{NAME}, 5, "[$name] THZ_Set searching for parent: $parent";
my $parenthash = $gets{$parent};
$parsingrule = $parsinghash{$parenthash->{type}};
# get the element index in parsingsrule for 2.xx firmware
for (@$parsingrule) {
last if ((@$parsingrule[$i]->[0]) =~ m/$cmd/);
$i++;
}
#overwrite with the parent values
$cmdcode = $parsinghash{$parenthash->{cmd2}};
$cmdtype = @$parsingrule[$i]->[3];
}
#-- check the parameter range
if (defined($parent) and ($cmdtype eq "hex2time")) {
# special validations for 2.xx firmware
my ($hour, $min) = split(':', $arg);
return "Argument does not contain a valid hour from 00 to 23 " if(($hour > 23) or ($hour < 0));
return "Argument does not contain a valid minute from 00 to 59 " if(($min > 59) or ($min < 0));
$arg = $hour * 100 + $min;
}
elsif ($cmdtype =~ /7prog|8party/) {         
($arg, $arg1) = split('--', $arg);
return "Argument does not match the allowed inerval Min $argMin ...... Max $argMax " if (($arg ne "n.a.") and ($arg1 ne "n.a.") and (($arg1 gt $argMax) or ($arg1 lt $argMin) or ($arg gt $argMax) or ($arg lt $argMin)) ) ;
}
elsif ($cmdtype eq "2opmode") {
$arg = $Rev_OpMode{$arg};
return "Unknown argument $arg1: $cmd supports  " . join(" ", sort values %OpMode) if(!defined($arg));
}
else {
#in all other cases assume numeric type
return "Argument does not match the allowed inerval Min $argMin ...... Max $argMax " if(($arg > $argMax) or ($arg < $argMin));
}


Your implementation of "bitx" is a good idea. Its working. But if you want even more hard core....

if ($parsingtype eq "quater") {
$arg = time2quaters($arg);
}
elsif ($parsingtype =~ /bit(\d)/) { # only in firmware 2.x
$arg = (hex(substr($msg, $pos, 1)) & ~(1<<$1)) | ((1<<$1)*$arg);
}

I would suggest to use if/elsif/else. It's more structured and faster.

Andre


immi

Hi Andre
thanks for testing
$arg ="10:09";
$arg= join('', (split(':', $arg)));
print $arg;
prints "1009"

it is a string in which you remove a ":" ... no problem
The with eval is safer...  OK
nevertheless if you want a syntax check, you get a syntax check; no problem

My target is to improve readability (performance in "set" is useless) ... and the subroutine "set" is getting too long
in perl  "switch/case" statements are terrible.
bestpractice (if you do not care about performance) is

command  if x>y;
command2 if ...;
command2 if ...;


I committed a version without full syntax check; now you have the same check as for 7prog|8party
sooner or later i will clean up the set function and improve the min-max check
immi

andre.k

#655
Hi immi,

Thank you for uploading the new version.
Zitatit is a string in which you remove a ":" ... no problem
OK, but if the user enters a string "20:8" on the command line, we set a wrong time.

I aggree performance is not realy a problem, but readability and logical structure is important.
Zitatcommand  if x>y;
command2 if ...;
command2 if ...;
This is definitly not best practice. Why should we check 3 conditions if the first condition matches and only one condition can be true? Here is the if/elsif/else the better way (if you don't like the switch statement).
The so called postfix if conditions should only be used in perl together with flow statements like return, next, last,...
But anyway if this is your way to make the code more readable and maintainable, I will respect this.

ZitatI committed a version without full syntax check; now you have the same check as for 7prog|8party
Not really, because the sets with "parent" don't have a "type". That's why I suggested to get the argument type from the parenthash before the validation of arguments starts. Or we give all sets with parents an additional "type" just for parameter checking.

Andre 

immi

Hi Andre
You are right in your example: "20:8" the "eval" variant is better, which is more robust

in 7prog|8party and in hex2time you can have easily the same check
all register "without type" can be checked to be between MAX and MIN
e.g. argMin => "00:00", argMax => "23:59"
the string should be in the interval 00:00 and 23:59.
you will not catch 13:65

nevertheless, I cite myself  "if you want a syntax check, you get a syntax check; no problem"
you just have to wait for the winter holidays.

p.s. I like a lot the "switch/case" statement!! (I used it in other languages extensively)
I had to change it with "given/when"
and at the end I  had to replace in THZ_Parse1 with  if/elsif/else.
You can google of the caos related to given/when and switch/case in perl.

When you read from tecalor, performance is an issue (my average 1 read per minute)
When you write to tecalor, performance is not  an issue (my average 1 write per day)
immi

peter456

Hallo andre.k, Hallo immi,

was hat sich eigentlich geändert bei dem letzten Update?
Ich habe so wie andre.k eine ältere LWZ303i mit Firmware 2.06.

andre.k

Hallo Peter,

du kannst seit 0.172 (fast) alle Parameter auch mit der Firmware v2.xx setzen. In der vorherigen Version konnte man die meisten Parameter nur lesen und nur die Parameter P01...12 sowie die Uhrzeit setzten. Ich persönlich benutze das sehr selten, aber es erspart die recht mühsame Eingabe über das Display der THZ.

peter456