Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShineWiFi-S compatibility #1

Open
the-butterfry opened this issue Apr 22, 2021 · 15 comments
Open

ShineWiFi-S compatibility #1

the-butterfry opened this issue Apr 22, 2021 · 15 comments

Comments

@the-butterfry
Copy link

the-butterfry commented Apr 22, 2021

Hey I don't expect you to know this, but maybe you do. I've got what I'm guessing is an older WiFi-F USB model. In your research on building this, did you come across anything that supports the protocol being the same? the -X seems to be an updated unit but I'm assuming they're interacting with the same growatt API, thus communicate identically.

Also, mine is reported as a -S model, but all online documentation and images match the -F linked above. I donno.

If you don't know, I'm willing to give it a go. I've got your script installed on a MQTT listening RPi onsite. but just need to go onsite and configure the module.

I think your approach is the best one of the many out there for getting data from these things and avoiding the bad growatt interface and communications.

@knowthelist
Copy link
Owner

Sorry, I don't know. I just tested it with my wifi stick. But I guess it's compatible with older versions of the protocol as well.
Just give it a try: Start it with full debug mode:

perl growatt_server.pl --debug=3

With this setting you can see if the client get connected and every message that come in.

@the-butterfry
Copy link
Author

got it, I'll report back when i get there later.

@the-butterfry
Copy link
Author

I think the difference between these is the inverter models.. I've got one of the All In One Charger/Inverter: SPF 3000TL LVM

P.S. in the readme you've got /ftui/ in the URL for install on your clone line.

@the-butterfry
Copy link
Author

Ok, here's the output:

`pi@Farm-pi:~/Growatt-server $ perl growatt_server.pl --debug=3
2021-04-22 13:52:07 Starting Growatt server on 0.0.0.0:5279
2021-04-22 13:52:09 Connection from 192.168.55.3 accepted
2021-04-22 13:52:11 ======= CLIENT ==== REQUEST =====
process_message type 0x16
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 DDD0A3912Q
2021-04-22 13:52:11 == received PING from DDD0A3912Q, sending reply ==

2021-04-22 13:52:11 ======= SERVER ==== REPLY =====
2021-04-22 13:52:11 ======= CLIENT ==== REQUEST =====
process_message type 0x03
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 55 4b 44 41 41 35 DDD0A3912QUKDAA5
0010: 31 30 33 37 15 04 16 0c 33 0b 02 00 00 00 2c 00 1037....3.....,.
0020: 01 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
0030: 02 35 30 32 2e 30 37 30 30 32 2e 30 34 00 00 ff .502.07002.04...
0040: ff 00 00 00 06 00 01 00 00 00 00 00 00 55 4b 44 .............UKD
0050: 41 41 35 31 30 33 37 00 00 00 00 00 01 01 00 00 AA51037.........
0060: 00 00 00 00 50 01 1b 01 10 00 e6 00 1e 00 02 00 ....P...........
0070: 00 00 00 00 00 4e 25 00 00 00 2d 00 59 07 e5 00 .....N%...-.Y...
0080: 04 00 16 00 0c 00 2a 00 31 00 00 00 00 00 00 00 ......*.1.......
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 75 30 00 .............u0.
00c0: 00 75 30 00 00 00 00 00 d2 00 00 04 b0 02 58 01 .u0...........X.
00d0: e0 02 58 01 2c 04 b0 ..X.,..
Month '-1' out of range 0..11 at growatt_server.pl line 410.`

@the-butterfry
Copy link
Author

the-butterfry commented Apr 22, 2021

image

I also tried changing date format, that didn't seem to help. I'll leave it like this for now to see if you have ideas.

@knowthelist
Copy link
Owner

your ANNOUNCE message doesn't contain a valid date. It is all zeros.
The script should ignore that. Could you add this lines before line 410?

    if ( $day < 1 ) { $day = 1; }
    if ( $month < 1 ) { $month = 1; }
    if ( $year < 1 ) { $year = 1970; }

@the-butterfry
Copy link
Author

the-butterfry commented Apr 22, 2021

this is what I ended up with:

my $now =
   timelocal( $tm[0], $tm[1], $tm[2], $tm[3], $tm[4], 1900 + $tm[5] );
 if ( $day < 1 ) { $day = 1; }
 if ( $month < 1 ) { $month = 1; }
 if ( $year < 1 ) { $year = 1970; }
 my $time = timelocal( $sec, $min, $hour, $day, $month -1, $year );

which now produces:
pi@Farm-pi:~/Growatt-server $ perl growatt_server.pl --debug=3
2021-04-22 16:29:37 Starting Growatt server on 0.0.0.0:5279
2021-04-22 16:29:39 Connection from 192.168.55.3 accepted
2021-04-22 16:29:39 ======= CLIENT ==== REQUEST =====
process_message type 0x19
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 00 05 00 01 31 DDD0A3912Q....1
'x' outside of string in unpack at growatt_server.pl line 425.

@the-butterfry
Copy link
Author

interesting, sometimes if i run it I get what looks like usable data:

pi@Farm-pi:~/Growatt-server $ sudo perl growatt_server.pl --debug=3
2021-04-22 16:35:22 Starting Growatt server on 0.0.0.0:5279
2021-04-22 16:35:25 Connection from 192.168.55.3 accepted
2021-04-22 16:35:25 ======= CLIENT ==== REQUEST =====
process_message type 0x19
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 00 0b 00 1d 23 23 DDD0A3912Q....##
0010: 31 39 32 2e 31 36 38 2e 33 2e 33 35 2f 61 70 70 192.168.3.35/app
0020: 2f 78 6d 6c 2f 23 38 30 38 31 23 /xml/#8081#
CONFIG of DDD0A3912Q 0x70 ml/#8081#
2021-04-22 16:35:26 ======= CLIENT ==== REQUEST =====
process_message type 0x16
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 DDD0A3912Q
2021-04-22 16:35:26 == received PING from DDD0A3912Q, sending reply ==

2021-04-22 16:35:26 ======= SERVER ==== REPLY =====
2021-04-22 16:35:26 ======= CLIENT ==== REQUEST =====
process_message type 0x50
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 55 4b 44 41 41 35 DDD0A3912QUKDAA5
0010: 31 30 33 37 15 04 16 0c 35 0b 02 00 00 00 2c 00 1037....5.....,.
0020: 0c 03 78 00 00 00 00 0a 00 00 00 00 00 00 5a 00 ..x...........Z.
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0040: 00 0a 8e 00 64 09 8c 00 00 00 00 04 b0 17 70 00 ....d.........p.
0050: 00 00 dd 00 da 00 00 00 00 00 00 00 00 00 00 00 ................
0060: db 00 f5 00 00 00 0b 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 00 00 00 4e 25 00 2d 00 59 00 01 00 .......N%.-.Y...
0080: 00 00 00 00 00 00 09 00 00 00 59 00 00 00 00 00 ..........Y.....
0090: 00 00 00 00 00 00 00 00 00 00 33 00 00 00 01 00 ..........3.....
00a0: 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff f6 ................
00c0: 78 00 00 00 00 00 00 00 17 00 5a 00 00 00 00 00 x.........Z.....
00d0: 01 00 00 00 07 00 00 .......
2021-04-22 16:35:26 == received BUFFERED_DATA from DDD0A3912Q, sending reply ==

timestamp: 2000-00-00 00:00:10
Eac_today: 0.0
Eac_total: 0.0
Ppv1: 1448367.4
Ipv1: 0.0
Vpv1: 600.0
Fac: 0.45
Vac1: 8.9
Iac1: 0.1
Pac1: 0.0
2021-04-22 16:35:26 ======= SERVER ==== REPLY =====
2021-04-22 16:35:27 ======= CLIENT ==== REQUEST =====
process_message type 0x19
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 00 0c 00 0f 58 58 DDD0A3912Q....XX
0010: 58 58 58 58 58 58 58 58 58 58 58 58 58 XXXXXXXXXXXXX
'x' outside of string in unpack at growatt_server.pl line 425.

@knowthelist
Copy link
Owner

Not really. Something must be shifted when decoding. We need a little more verbose log.

Please start with log level 4 to get the raw messages

perl growatt_server.pl --debug=4

@the-butterfry
Copy link
Author

the-butterfry commented Apr 23, 2021

pi@Farm-pi:~/Growatt-server $ perl growatt_server.pl --debug=4
2021-04-22 22:59:51 Starting Growatt server on 0.0.0.0:5279
2021-04-22 22:59:57 Connection from 192.168.55.3 accepted
2021-04-22 22:59:57 ======= CLIENT ==== REQUEST =====
RAW
0000: 00 02 00 05 00 0c 01 16 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 08 bd @>..

split_message buffer_length 20
split_message protocol_id5
split_message message size12
decode_message message CRC 2237 calculated CRC 2237
process_message type 0x16
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 DDD0A3912Q
2021-04-22 22:59:57 == received PING from DDD0A3912Q, sending reply ==

2021-04-22 22:59:57 ======= SERVER ==== REPLY =====
RAW
0000: 00 02 00 05 00 0c 01 16 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 08 bd @>..

split_message buffer_length 0
2021-04-22 23:00:05 ======= CLIENT ==== REQUEST =====
RAW
0000: 00 02 00 05 00 d9 01 03 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 22 2a 30 35 06 47 5e 47 52 43 74 47 72 6f @>"*05.G^GRCtGro
0020: 77 61 76 74 47 72 43 77 60 74 75 47 73 6f 77 61 wavtGrCwtuGsowa 0030: 74 74 47 72 6f 77 61 74 76 72 42 5d 59 51 43 44 ttGrowatvrB]YQCD 0040: 77 40 41 47 55 74 74 b8 8d 6f 77 61 72 74 46 72 [email protected] 0050: 6f 77 61 74 74 12 39 2b 36 20 41 45 77 41 58 77 owatt.9+6 AEwAXw 0060: 61 74 74 47 73 6e 77 61 74 74 47 72 3f 76 7a 75 attGsnwattGr?vzu 0070: 64 47 94 6f 69 61 76 74 47 72 6f 77 61 3a 51 47 dG.oiavtGrowa:QG 0080: 72 6f 5a 61 2d 73 a2 72 6b 77 77 74 62 47 48 6f roZa-s.rkwwtbGHo 0090: 68 61 74 74 47 72 6f 77 61 74 74 47 72 6f 77 61 hattGrowattGrowa 00a0: 74 74 47 72 6f 77 61 74 74 47 72 6f 77 61 74 74 ttGrowattGrowatt 00b0: 47 72 6f 77 61 74 74 47 72 6f 77 61 74 74 47 72 GrowattGrowattGr 00c0: 6f 77 61 74 74 32 42 6f 77 14 44 74 47 72 6f 77 owatt2Bow.DtGrow 00d0: b3 74 74 43 c2 6d 2f 60 94 76 1f 73 43 73 d1 91 .ttC.m/.v.sCs..
00e0: 8c .

split_message buffer_length 225
split_message protocol_id5
split_message message size217
decode_message message CRC 37260 calculated CRC 37260
process_message type 0x03
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 55 4b 44 41 41 35 DDD0A3912QUKDAA5
0010: 31 30 33 37 00 00 00 00 00 00 02 00 00 00 2c 00 1037..........,.
0020: 01 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
0030: 02 35 30 32 2e 30 37 30 30 32 2e 30 34 00 00 ff .502.07002.04...
0040: ff 00 00 00 06 00 01 00 00 00 00 00 00 55 4b 44 .............UKD
0050: 41 41 35 31 30 33 37 00 00 00 00 00 01 01 00 00 AA51037.........
0060: 00 00 00 00 50 01 1b 01 10 00 e6 00 1e 00 02 00 ....P...........
0070: 00 00 00 00 00 4e 25 00 00 00 2d 00 59 07 e5 00 .....N%...-.Y...
0080: 04 00 16 00 16 00 3a 00 1f 00 00 00 00 00 00 00 ......:.........
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 75 30 00 .............u0.
00c0: 00 75 30 00 00 00 00 00 d2 00 00 04 b0 02 58 01 .u0...........X.
00d0: e0 02 58 01 2c 04 b0 ..X.,..
2021-04-22 23:00:05 == received ANNOUNCE from DDD0A3912Q for inverter ,���, sending reply ==

time diff:1619128805
diff > 60 => correct time on client now.
2021-04-22 23:00:05 ======= SERVER ==== REPLY =====
RAW
0000: 00 02 00 05 00 23 01 18 03 36 2b 47 20 47 4d 76 .....#...6+G GMv
0010: 40 3e 77 7e 74 67 75 42 5d 46 4c 44 40 6a 40 5d @>w~tguB]FLD@j@]
0020: 57 53 47 4e 77 42 55 47 54 5a 83 WSGNwBUGTZ.

2021-04-22 23:00:05 ======= SERVER ==== REPLY =====
RAW
0000: 00 02 00 05 00 03 01 03 47 3a 9a ........G:.

2021-04-22 23:00:05 ======= SERVER ==== REPLY =====
RAW
0000: 00 02 00 05 00 10 01 19 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 77 65 74 6b 28 4f @>wetk(O

split_message buffer_length 0
2021-04-22 23:00:08 ======= CLIENT ==== REQUEST =====
RAW
0000: 00 02 00 05 00 d9 01 50 03 36 2b 47 20 47 4d 76 .......P.6+G GMv
0010: 40 3e 22 2a 30 35 06 47 5e 47 52 43 61 43 64 62 @>"*05.G^GRCaCdb
0020: 76 7f 76 74 47 72 43 77 6d 77 dd 47 72 6f 77 6b v.vtGrCwmw.Growk
0030: 74 74 47 72 6f 77 3c 74 74 47 72 6f 77 61 74 74 ttGrow<ttGrowatt
0040: 47 72 6f 77 61 74 74 47 72 65 e2 61 10 7d ca 72 GrowattGre.a.}.r
0050: 6f 77 61 70 c5 50 1d 6f 77 61 aa 74 9c 72 6f 77 owap.P.owa.t.row
0060: 61 74 74 47 72 6f 77 61 a8 74 b1 72 6f 77 6d 74 attGrowa.t.rowmt
0070: 74 47 72 6f 77 61 74 74 47 72 6f 77 61 74 74 09 tGrowattGrowatt.
0080: 57 6f 5a 61 2d 74 46 72 6f 77 61 74 74 47 78 6f WoZa-tFrowattGxo
0090: 77 61 2e 74 47 72 6f 77 61 74 74 47 72 6f 77 61 wa.tGrowattGrowa
00a0: 74 74 74 72 6f 77 60 74 74 47 76 6f 77 61 74 74 tttrow`ttGvowatt
00b0: 47 72 6f 77 61 74 74 47 72 6f 77 61 74 74 47 72 GrowattGrowattGr
00c0: 6f 77 61 74 74 b8 8d 98 05 61 74 74 47 72 6f 77 owatt....attGrow
00d0: 77 74 25 47 72 6f 77 61 75 74 47 72 68 77 61 70 wt%GrowautGrhwap
00e0: 6a j

split_message buffer_length 225
split_message protocol_id5
split_message message size217
decode_message message CRC 28778 calculated CRC 28778
process_message type 0x50
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 55 4b 44 41 41 35 DDD0A3912QUKDAA5
0010: 31 30 33 37 15 04 16 0d 01 1e 02 00 00 00 2c 00 1037..........,.
0020: 0c 03 a9 00 00 00 00 0a 00 00 00 00 00 00 5d 00 ..............].
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0040: 00 0a 95 00 64 09 8d 00 00 00 00 04 b1 17 6f 00 ....d.........o.
0050: 00 00 de 00 db 00 00 00 00 00 00 00 00 00 00 00 ................
0060: dc 00 f6 00 00 00 0c 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 00 00 00 4e 25 00 2d 00 59 00 01 00 .......N%.-.Y...
0080: 00 00 00 00 00 00 0a 00 00 00 5a 00 00 00 00 00 ..........Z.....
0090: 00 00 00 00 00 00 00 00 00 00 33 00 00 00 01 00 ..........3.....
00a0: 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff f7 ................
00c0: 72 00 00 00 00 00 00 00 16 00 51 00 00 00 00 00 r.........Q.....
00d0: 01 00 00 00 07 00 00 .......
2021-04-22 23:00:08 == received BUFFERED_DATA from DDD0A3912Q, sending reply ==

timestamp: 2000-00-00 00:00:10
Eac_today: 0.0
Eac_total: 0.0
Ppv1: 1454921.1
Ipv1: 0.0
Vpv1: 599.9
Fac: 0.45
Vac1: 8.9
Iac1: 0.1
Pac1: 0.0
2021-04-22 23:00:08 ======= SERVER ==== REPLY =====
RAW
0000: 00 02 00 05 00 03 01 50 47 ca a6 .......PG..

split_message buffer_length 0
2021-04-22 23:00:08 ======= CLIENT ==== REQUEST =====
RAW
0000: 00 02 00 05 00 0f 01 18 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 77 7e 74 46 49 @>w~tFI

split_message buffer_length 23
split_message protocol_id5
split_message message size15
decode_message message CRC 17993 calculated CRC 17993
process_message type 0x18
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 00 1f 00 DDD0A3912Q...
2021-04-22 23:00:08 == unhandled message ==

split_message buffer_length 0
2021-04-22 23:00:08 ======= CLIENT ==== REQUEST =====
RAW
0000: 00 02 00 05 00 11 01 19 03 36 2b 47 20 47 4d 76 .........6+G GMv
0010: 40 3e 77 65 74 75 76 4e b0 @>wetuvN.

split_message buffer_length 25
split_message protocol_id5
split_message message size17
decode_message message CRC 20144 calculated CRC 20144
process_message type 0x19
process_message data
0000: 44 44 44 30 41 33 39 31 32 51 00 04 00 01 31 DDD0A3912Q....1
'x' outside of string in unpack at growatt_server.pl line 425.

@knowthelist
Copy link
Owner

you have protocol version 5. This have to be decodes differently. I try to figure it out and adapt the code accordingly.

@the-butterfry
Copy link
Author

Don't spend too much time on it, I think someone has already figured it out. Check out the project over at Grott https://github.com/johanmeijer/grott

@knowthelist
Copy link
Owner

I added some protocol 5 specifics, but the output values for your examples of message 0x50 make no sense to me. I tried a lot of position and also the settings from other projects.
Can you say what values can be expected?

Eac_today: e.g. 3KWh
Eac_total: ?
Ppv1: ?
Ipv1: ?
Vpv1: ?
Fac: 50 or 60Hz
Vac1: 120V or 230V
Iac1: ?
Pac1: ?

@gabrielpc1190
Copy link

Maybe you need to talk to JohanMeijer to coordinate a better version of both codes.
He's pretty active on his project and your idea it's pretty good

@Lasszo
Copy link

Lasszo commented Mar 7, 2023

Hello guys,

Did some one managed to get it work recently ?

Month '88' out of range 0..11 at growatt_server.pl line 416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants