rjblake / remeha

Connect ESP8266 directly to Remeha CV/Boiler to read data using PHP
28 stars 13 forks source link

Problem with ESP-Link and connecting to Remeha #2

Closed djsuszi closed 6 years ago

djsuszi commented 6 years ago

Script send some data and recived some from boiler, but there is something wrong with communication

CRC Error | 2018-01-09 12:06:01 | 02 ffdff7ffffffffefffffff 03| CRC Error | 2018-01-09 12:06:17 | 02 ffffffffffffffffffffffff 03| CRC Error | 2018-01-09 12:06:32 | 02 fffffdfffdffffffff7fffff 03| CRC Error | 2018-01-09 12:06:47 | 02 fdfeffffffff 03| CRC Error | 2018-01-09 12:07:07 | 02 03| CRC Error | 2018-01-09 12:07:23 | 02 fffbffff 03| CRC Error | 2018-01-09 12:07:38 | 02 fffffffdffbfffffff 03| CRC Error | 2018-01-09 12:07:53 | 02 ffffff 03| CRC Error | 2018-01-09 12:08:14 | 02 03| CRC Error | 2018-01-09 12:08:29 | 02 ffdfff 03| CRC Error | 2018-01-09 12:08:49 | 02 03| CRC Error | 2018-01-09 12:09:05 | 02 fdfbff 03| CRC Error | 2018-01-09 12:09:25 | 02 03| CRC Error | 2018-01-09 12:09:40 | 02 fffffffbffffffdb 03| CRC Error | 2018-01-09 12:09:56 | 02 ffffffffff7f 03|

screenshot of my ESP-Link configuration, I run it on NodeMCU. It's connected directly to board.

image If I enable "RX pull-up" I don't see any data.

Magic number "02FE010508020169AB03" are OK, because I sniff it from USB serial and Recom software.

Maybe you have some idea, what can be wrong ?

rjblake commented 6 years ago

If you can communicate with the boiler using Serial and Recom, then that is unlikely to be the issue and it is somewhere else. Unfortunately the CRC error simply says the data received does not add up/is incorrect. One thing that I see, is that you have SLIP enabled. I have this disabled and also RX pull-up selected. Suggest to start by disabling SLIP (tickbox) on the REST/MQTT page and enabling RX pull-up. Other than that, I have seen these errors on occassion on my system, but a retsart of the ESP8266, or they simply self correct.

djsuszi commented 6 years ago

under console: Baud: 9600 Fmt: 8N1 ?

as I understood, between 02 and 03 CRC Error | 2018-01-09 12:09:40 | 02 fffffffbffffffdb 03| is data which boiler send through RS ?

rjblake commented 6 years ago

Yes, it should be 9600 8N1. The data between the 02 and the 03 is the data received back; but it is clearly wrong as the CRC check fails (i.e. is not a valid response). Did you check the uC Console Log on the ESP, but more important did you try with SLIP diasbled? What ESP make/model ESP are you using? What model CV boiler do you have?

You can also install a Serial Emulator on you PC/Mac and connect directly to the ESP wired to the boiler over WiFi to check that this is not the issue. However, it seems that data is being sent and received by the ESP, it is just not the correct data.

djsuszi commented 6 years ago

problem was in power, when I use power from boiler it's better working.

I use Easy ESP and it's serial and it's working with this script https://github.com/aequitas/remeha and mapping tcp port to local serial: socat -x pty,link=/dev/ttyTCP0,mode=777 tcp:192.168.109.104:23

socat logs:

2018/01/15 22:32:15.999858 length=10 from=0 to=9 02 fe 01 05 08 02 01 69 ab 03 < 2018/01/15 22:32:17.311060 length=74 from=0 to=73 02 01 fe 06 48 02 01 84 13 24 0d 80 f3 2c fc 42 13 00 80 17 10 00 80 8c 13 5c 12 00 80 d3 09 d4 09 3b 8c 13 25 46 00 64 25 00 00 14 c6 40 95 03 ff ff 1e be 0c 04 ff ff 00 c0 86 13 00 00 00 00 80 47 03 45 2f 00 00 b4 b8 03 2018/01/15 22:32:29.022225 length=10 from=10 to=19 02 fe 01 05 08 02 01 69 ab 03 < 2018/01/15 22:32:30.207148 length=74 from=74 to=147 02 01 fe 06 48 02 01 85 13 24 0d 80 f3 2c fc 41 13 00 80 18 10 00 80 8c 13 5c 12 00 80 d7 09 d8 09 3a 8c 13 26 46 00 64 26 00 00 14 c6 40 95 03 ff ff 1e c2 0c 04 ff ff 00 c0 86 13 00 00 00 00 80 47 03 45 2f 00 00 9e 92 03

from your script I get: PHP version: 7.0.22-0ubuntu0.16.04.1 Connected to 192.168.109.104:23 Sending request... Sample Data read: Data written to log: /home/pi/remeha/remeha_sample_data.log

** CRC ERROR!!!! ***

so no data is getting back,

when I run socat -x pty,link=/dev/ttyTCP0,mode=777 tcp:192.168.109.104:23 and remeha_sample: echo -n -e '\x02\xFE\x01\x05\x08\x02\x01\x69\xAB\x03' >> /dev/ttyTCP0 I get answer:

2018/01/15 22:50:45.141747 length=10 from=0 to=9 02 fe 01 05 08 02 01 69 ab 03 < 2018/01/15 22:50:46.457138 length=74 from=0 to=73 02 01 fe 06 48 02 01 90 13 17 0d 80 f3 18 fc 2c 13 00 80 04 10 00 80 98 13 5c 12 00 80 01 0a 01 0a 3b 98 13 27 46 00 64 27 00 00 14 c6 40 95 03 ff ff 1e ed 0c 04 ff ff 00 c0 90 13 00 00 00 00 80 47 03 45 2f 00 00 d2 c1 03 2018/01/15 22:50:46.459238 length=40 from=10 to=49 5e 42 5e 41 fe 5e 46 48 5e 42 5e 41 90 5e 43 ff ff 5e 5e ed 5e 4c ff ff 5e 40 c0 90 5e 43 45 2f 5e 40 5e 40 d2 c1 5e 43

2018/01/15 22:50:56.550954 length=10 from=50 to=59 02 fe 01 05 08 02 01 69 ab 03 < 2018/01/15 22:50:57.860265 length=74 from=74 to=147 02 01 fe 06 48 02 01 91 13 17 0d 80 f3 18 fc 2d 13 00 80 05 10 00 80 98 13 5c 12 00 80 05 0a 06 0a 3b 98 13 27 46 00 64 27 00 00 14 c6 40 95 03 ff ff 1e f2 0c 04 ff ff 00 c0 90 13 00 00 00 00 80 47 03 45 2f 00 00 43 60 03 2018/01/15 22:50:57.862359 length=40 from=60 to=99 5e 42 5e 41 fe 5e 46 48 5e 42 5e 41 91 5e 43 ff ff 5e 5e f2 5e 4c ff ff 5e 40 c0 90 5e 43 45 2f 5e 40 5e 40 43 60 5e 43

for script

<?php
require('remeha_functions.php');
$ini_array = parse_ini_file("remeha.ini");
$ESPIPAddress = $ini_array['ESPIPAddress'];
$ESPPort = $ini_array['ESPPort'];
$retries = $ini_array['retries'];
$sleeptime = $ini_array['sleeptime'];
$sample_loops = $ini_array['sample_loops'];
$nanosleeptime =  $ini_array['nanosleeptime'];
$echo_flag = $ini_array['echo_flag'];
$newline = $ini_array['newline'];
        if ($newline == "terminal"){$newline = "\n";}
        elseif ($newline == "windows"){$newline = "\r\n";}
        else {$newline = "<br />";}
$deg_symbol = $ini_array['deg_symbol'];
$remeha_sample = hex2bin($ini_array['remeha_sample']);
$remeha_counter1 = hex2bin($ini_array['remeha_counter1']);
$remeha_counter2 = hex2bin($ini_array['remeha_counter2']);
$remeha_counter3 = hex2bin($ini_array['remeha_counter3']);
$remeha_counter4 = hex2bin($ini_array['remeha_counter4']);
                $fp = connect_to_esp($ESPIPAddress, $ESPPort, $retries, $newline);
                if (!$fp)
                        {
                        exit("Unable to establish connection to $ESPIPAddress:$ESPPort$newline");
                        }
                else
                        {
                        cls();
                        stream_set_timeout($fp, 5);
                        // Collect Sample Data Info
                        conditional_echo(str_repeat("=", 166) . "$newline", $echo_flag);
                        conditional_echo("Connected to $ESPIPAddress:$ESPPort$newline", $echo_flag);
                        conditional_echo("Sending request...: $newline", $echo_flag);
                        print $ini_array['remeha_sample'].$newline;
                        fwrite($fp,$remeha_sample, 10);
                        $data_sample = "";
                        $data_sample = bin2hex(fread($fp, 148));
                        $data_sampleU = strtoupper($data_sample);
                        conditional_echo("Sample Data read: $data_sampleU$newline", $echo_flag);
                        #$output = sample_data_dump($data_sample, $echo_flag, $newline);
                        fclose($fp);
?>

I get: Connected to 192.168.109.104:23 Sending request...: 02FE010508020169AB03 Sample Data read:

djsuszi commented 6 years ago

for other script I get remeha-counters.php PHP version: 7.0.22-0ubuntu0.16.04.1
Connected to 192.168.109.104:23
Sending request...
Counter Data-1 read:
Counter Data-2 read: 0200FE0618101D01FC0005003700000000000000FEFF7956CF03
Counter Data-3 read: 0200FE0618101E0AC400A7099D014B142B00AE00BF007B900903
Counter Data-4 read: 0200FE0618101F01FC0005003700000000000000FEFF79F7AF03
Data written to log: /home/pi/remeha/remeha_counter_data.log

** CRC ERROR!!!! ***

remeha-identification.php Connected to 192.168.109.104:23
Sending request...
ID-01 read:
ID-02 read: 0201FE0618010B0516FF0313500104160EFFFFFFFFFFFF6FEB03
ID-03 read: 0203FE0618010B0115250105020504020E2C1607500037DC9F03
Identification used: 020516FF0313500104160EFFFFFFFFFFFF0115250105020504020E2C1607500037
Data written to log: /home/pi/remeha/remeha_identification_data.log

** CRC ERROR!!!! ***

remeha-parameters.php Connected to 192.168.109.104:23
Sending request...
Param-01 read:
Param-02 read: 0200FE061810152F2F0B5017FF4B230F23EE070AF60014F72E03
Param-03 read: 0200FE06181016040001020000000100571E02FFFFFFFF414003
Param-04 read: 0200FE06181017FFFFFFFFFFFF323C5000C80500128E1C89F003
Param-05 read: 0200FE06181018FF28465A3219051E0A1E0309414114647C4A03
Param-06 read: 0200FE061810196464074605051E0205002800000FBC09BC5F03
Param-07 read: 0200FE0618101A0078000A051E654B00FE0A000A64FF28906103
Param-08 read: 0200FE0618101B1A02050502020514141905FFFFFF859AE38903
Parameters used: 022F2F0B5017FF4B230F23EE070AF60014040001020000000100571E02FFFFFFFFFFFFFFFFFFFF323C5000C80500128E1CFF28465A3219051E0A1E0309414114646464074605051E0205002800000FBC090078000A051E654B00FE0A000A64FF281A02050502020514141905FFFFFF859A
Data written to log: /home/pi/remeha/remeha_parameter_data.log

** CRC ERROR!!!! ***

so first request is always missing, for example for when I add //send first request fwrite($fp,"1111", 10); $data_param1 = bin2hex(fread($fp, 52)); before first fwrite in remeha-parameters.php it's working fine Sending request...
Param-01 read: 0200FE061810143737010005FFFFFFFFFFFFFFFFFFFFFF9AB6C3
Param-02 read: 0200FE061810152F2F0B5017FF4B230F23EE070AF60014F72E03
Param-03 read: 0200FE06181016040001020000000100571E02FFFFFFFF414003
Param-04 read: 0200FE06181017FFFFFFFFFFFF323C5000C80500128E1C89F003
Param-05 read: 0200FE06181018FF28465A3219051E0A1E0309414114647C4A03
Param-06 read: 0200FE061810196464074605051E0205002800000FBC09BC5F03
Param-07 read: 0200FE0618101A0078000A051E654B00FE0A000A64FF28906103
Param-08 read: 0200FE0618101B1A02050502020514141905FFFFFF859AE38903
Parameters used: 0200FE061810143737010005FFFFFFFFFFFFFFFFFFFFFF2F2F0B5017FF4B230F23EE070AF60014040001020000000100571E02FFFFFFFFFFFFFFFFFFFF323C5000C80500128E1CFF28465A3219051E0A1E0309414114646464074605051E0205002800000FBC090078000A051E654B00FE0A000A64FF281A02050502020514141905FFFFFF859A
Data Integrity Good - CRCs Compute OK

rjblake commented 6 years ago

I have not tried using ESP Easy and Socat, so cannot comment on the specific issue you are having. I do know that others have flashed with ESP Link and it works. I have this running for well over a year and only power cycles have been when boiler was undergoing maintenance. Power is provided by the Remeha boiler, so do not add additional/external power to the ESP, as this is very likely to be an issue unless you add more circuitry and opto couplers, etc..

On Tue, Jan 16, 2018 at 12:42 AM, djsuszi notifications@github.com wrote:

for other script I get remeha-counters.php PHP version: 7.0.22-0ubuntu0.16.04.1

Connected to 192.168.109.104:23

Sending request...

Counter Data-1 read:

Counter Data-2 read: 0200FE0618101D01FC0005003700000000000000FEFF7956CF03

Counter Data-3 read: 0200FE0618101E0AC400A7099D014B142B00AE00BF007B900903

Counter Data-4 read: 0200FE0618101F01FC0005003700000000000000FEFF79F7AF03

Data written to log: /home/pi/remeha/remeha_counter_data.log

** CRC ERROR!!!! ***

remeha-identification.php Connected to 192.168.109.104:23

Sending request...

ID-01 read:

ID-02 read: 0201FE0618010B0516FF0313500104160EFFFFFFFFFFFF6FEB03

ID-03 read: 0203FE0618010B0115250105020504020E2C1607500037DC9F03

Identification used: 020516FF0313500104160EFFFFFFFF FFFF0115250105020504020E2C1607500037

Data written to log: /home/pi/remeha/remeha_identification_data.log

** CRC ERROR!!!! ***

remeha-parameters.php Connected to 192.168.109.104:23

Sending request...

Param-01 read:

Param-02 read: 0200FE061810152F2F0B5017FF4B230F23EE070AF60014F72E03

Param-03 read: 0200FE06181016040001020000000100571E02FFFFFFFF414003

Param-04 read: 0200FE06181017FFFFFFFFFFFF323C5000C80500128E1C89F003

Param-05 read: 0200FE06181018FF28465A3219051E0A1E0309414114647C4A03

Param-06 read: 0200FE061810196464074605051E0205002800000FBC09BC5F03

Param-07 read: 0200FE0618101A0078000A051E654B00FE0A000A64FF28906103

Param-08 read: 0200FE0618101B1A02050502020514141905FFFFFF859AE38903

Parameters used: 022F2F0B5017FF4B230F23EE070AF6 0014040001020000000100571E02FFFFFFFFFFFFFFFFFFFF323C5000C805 00128E1CFF28465A3219051E0A1E0309414114646464074605051E020500 2800000FBC090078000A051E654B00FE0A000A64FF281A02050502020514 141905FFFFFF859A

Data written to log: /home/pi/remeha/remeha_parameter_data.log

** CRC ERROR!!!! ***

so first request is always missing, for example for when I add //send first request fwrite($fp,"1111", 10); $data_param1 = bin2hex(fread($fp, 52)); before first fwrite in remeha-parameters.php it's working fine Sending request...

Param-01 read: 0200FE061810143737010005FFFFFFFFFFFFFFFFFFFFFF9AB6C3

Param-02 read: 0200FE061810152F2F0B5017FF4B230F23EE070AF60014F72E03

Param-03 read: 0200FE06181016040001020000000100571E02FFFFFFFF414003

Param-04 read: 0200FE06181017FFFFFFFFFFFF323C5000C80500128E1C89F003

Param-05 read: 0200FE06181018FF28465A3219051E0A1E0309414114647C4A03

Param-06 read: 0200FE061810196464074605051E0205002800000FBC09BC5F03

Param-07 read: 0200FE0618101A0078000A051E654B00FE0A000A64FF28906103

Param-08 read: 0200FE0618101B1A02050502020514141905FFFFFF859AE38903

Parameters used: 0200FE061810143737010005FFFFFF FFFFFFFFFFFFFFFF2F2F0B5017FF4B230F23EE070AF60014040001020000 000100571E02FFFFFFFFFFFFFFFFFFFF323C5000C80500128E1CFF28465A 3219051E0A1E0309414114646464074605051E0205002800000FBC090078 000A051E654B00FE0A000A64FF281A02050502020514141905FFFFFF859A

Data Integrity Good - CRCs Compute OK

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rjblake/remeha/issues/2#issuecomment-357813618, or mute the thread https://github.com/notifications/unsubscribe-auth/AJeHOmQJwNGUPYWnGRGfHhiiewXrEa1Zks5tK-JqgaJpZM4RXq8p .

rjblake commented 6 years ago

Closing as no feedback received and solution is working with ESP-Link as designed