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

concerning your direct connection to the usb of the heatpump.
You got hterm work, now you can test if your perl is working.
The script enclosed is selfexplaining

C:\Strawberry\fhem>perl testserialthz.pl
10
----
1002
----
0100b6fd01b71003



concerning your rs232 cable: pay attention that TX at rest should be below -4.5V
https://upload.wikimedia.org/wikipedia/commons/e/e1/RS232-UART_Oscilloscope_Screenshot.png
check again the cable: I remember that the bottom pin  of the rs232 of the heatpump is gnd
immi

Matthias-56

Hi Immi,
great support!

I was also working ...

Yesterday I got new cable.
I investigated wiring inside THZ.

- RS232 Connector at THZ from top to bottom --> 1, 2, 3 (as You are writing)
- Baudrate 115200

--> RS232 connection stabil established.

So I can use FHEM for my THZ.

Thank You for the script. I will try to understand.
Did not use it till now because nearly same time RS232 worked.
My perl configuration seems ok.
Using Strawberry Perl Portable on Win10.

Direct connection FHEM THZ via USB does not work. THZ state = disconnected.
Same connection via e.g. Hterm ok.

According my experience the different USB - serial controller and/or win10 driver could be root cause.
Profilic --> state connected (external cable)
FTDI    --> state connected (external cable)
CP210x--> state disconnected (THZ onboard USB - serial controller)

Matthias

immi

Zitat von: Matthias-56 am 20 Oktober 2021, 08:17:07
--> RS232 connection stabil established.
So I can use FHEM for my THZ.
excellent

Zitat
My perl configuration seems ok.
Using Strawberry Perl Portable on Win10.
The perl script will help you debugging without the complex construct of fhem.
It is very very easy to check the serial handshake, or other serial peculiarities linked to your special driver.
It would be great if you could share the results in the forum.

Motivation: Maybe some other users will benefit.
Making the rs232 cable and using linux is my preferred way, but it can be intimidating for many users.
Therefore I like to support also direct-usb connection and windows.... Are you familiar with the concept of gateway drug :)

Matthias-56

It would be great if you could share the results in the forum.
... Give me short time.
Where to place such result?
I found a disadvantage using forum as there a lot of information but not organizeabel for fast finding.

Are you familiar with the concept of gateway drug

  Is this a drug which lead people try one week or more to place a serial connection? ;)


Matthias








immi

hi Matthias
take your time and enjoy the nice weather today :)

ZitatWhere to place such result?
The forum is for problemsolving discussion and for preliminary results.

The final solution, even better an howto should go in the wiki
https://wiki.fhem.de/wiki/Tecalor_THZ_W%C3%A4rmepumpe
you can edit it yourself or send the  change to Micromat ; I have never done it


A very short hint can also go in the commandref; I should do it, because hardlinked in fhem-source-code.
immi



Matthias-56

Hi Immi,

Test Com4 = USB - Serial cable, Profilic chip

C:\MyFHEM>perl\bin\perl testserialthz.pl
10
----
1002
----
0100b6fd01b71003

Test Com3 = THZ USB direct CP210x chip

C:\MyFHEM>perl\bin\perl testserialthz.pl
invalid COMMPROP block length= 66 at testserialthz.pl line 10.
Can't open COM3:

line 10:
$PortObj = new Win32::SerialPort ($PortName)  || die "Can't open $PortName: $^E\n";   

Bug in Win32::SerialPort or in CP210x driver?

Matthias


immi

Zitat von: Matthias-56 am 20 Oktober 2021, 17:32:19
Bug in Win32::SerialPort or in CP210x driver?
now it is clear
"COMMPROP block length= 66"  looks like a pretty old problem
https://rt.cpan.org/Public/Bug/Display.html?id=33559
unfixed bug in perl for windows or an unproper api of the driver CP210x
for sure not a fhem issue.
immi



Matthias-56

ok. In the linked article Wim de Vries changed a value in commport.pm to 66 in line639.
I did the same but no success.  :(
Is there a workaround?

Matthias

immi

no... if it is not fixed since 10years, there is no easy fix

Matthias-56

Hi Immi,

I remembered that I saw the error ... block length 66 ... already before.
If FHEM try to open com port the modul devio.pm is used.
This seems to replace the original io.pm.
It is signed by Rudolf Koenig.
Is'nt it the lucky situation that this problem could be solved by the FHEM developer?

Matthias

2021.10.21 09:54:28 3: Opening myTHZ_403 device COM3
2021.10.21 09:54:29 1: PERL WARNING: invalid COMMPROP block length= 66 at C:\MyFHEM/FHEM/DevIo.pm line 593.
2021.10.21 09:54:29 1: myTHZ_403: Can't open COM3: No such file or directory
Zugriff verweigert

2021.10.21 09:54:29 1: PERL WARNING: can't open device: \\.\COM3
at C:\MyFHEM/FHEM/DevIo.pm line 593.
Zugriff verweigert

immi

Hallo Jörg/hellijo
just plot  seasonMode and see if it is the reading of which you are interesten in.

as I already wrote before, I never used homebridge.
I expect that you cannot address seasonMode with the sintax you used.
I expect that you can solve your issue with userreadings --> see example heatingState in https://wiki.fhem.de/wiki/Homebridge_User_Configs

if you post here (heatpump code improvement), nobody can support you properly
the right place would be --> module owner  Andre (justme1968) in forum Frontends/Sprachsteuerung

immi

Matthias-56

Hi Immi,
may be You had not seen my post from 2021-10-21 10 am?
Concerning to share my results here main points I missed.


1. Cable RS232 to connect THZ with PC

THZ MNL connector            PC Sub-D male
(PIN 1 at the top)

TxD  1   -----------------------------------   2  (Rxd)
RxD   2   -----------------------------------   3  (TxD)
gnd   3   -----------------------------------   5  gnd

2. Win10 define com port
   define name THZ comx@115200 (or other value 9600 ... 115200; individuell)

3. USB direct connection - known problem
   problems with Win10 driver in common with THZ onboard USB - Serial chip CP210x


Matthias

immi

Zitat von: Matthias-56 am 21 Oktober 2021, 10:02:09
I remembered that I saw the error ... block length 66 ... already before.
If FHEM try to open com port the modul devio.pm is used.
This seems to replace the original io.pm.
It is signed by Rudolf Koenig.
Is'nt it the lucky situation that this problem could be solved by the FHEM developer?
Hi Matthias
devio.pm in fhem calls Win32::SerialPort, like I do in the script.... just in a more fancy way.
If Win32::SerialPort does not work for you in the script, it will also not work in fhem
Win32::SerialPort does not belong to FHEM...
https://metacpan.org/pod/Win32::SerialPort
immi

Matthias-56

what a pitty!

So You don't go boring see below.

2021.10.22 12:23:30 3: Opening myTHZ_403 device COM3
2021.10.22 12:23:30 3: Setting myTHZ_403 serial parameters to 115200,8,N,1
2021.10.22 12:23:30 3: myTHZ_403 device opened
2021.10.22 12:24:01 3: THZ_Get: Error msg2:  THZ_ReadAnswer: InterfaceNotRespondig. Maybe too slow THZ_Get_Com: error found at step0  -- 0B0005 ->

Background:
I'm using the FritzBox Remote USB now.
Communication Hterm and THZ is ok in this configuration (0x02 --> 0x10).
Port opening on THZ module also ok. USB - Serial adapter accepted by FHEM.

Why I got error msg2 ?
I tried already SimpleReadTimeout up to 1s but I don't know if it makes sense.

Matthias


Matthias-56

test result from testserialthz.

PS H:\myFHEM> perl\bin\perl testserialthz.pl

----


Second Write attempted before First is done at testserialthz.pl line 34.
Use of uninitialized value $written in numeric ne (!=) at H:/MyFHEM/perl/vendor/lib/Win32/SerialPort.pm line 1580.
Second Read attempted before First is done at testserialthz.pl line 35.
Use of uninitialized value $got in numeric ne (!=) at H:/MyFHEM/perl/vendor/lib/Win32/SerialPort.pm line 1216.

----
Second Write attempted before First is done at testserialthz.pl line 41.
Use of uninitialized value $written in numeric ne (!=) at H:/MyFHEM/perl/vendor/lib/Win32/SerialPort.pm line 1580.
Second Read attempted before First is done at testserialthz.pl line 42.
Use of uninitialized value $got in numeric ne (!=) at H:/MyFHEM/perl/vendor/lib/Win32/SerialPort.pm line 1216.
PS H:\myFHEM>