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

Enables support for IM350 #20038

Closed
wants to merge 2 commits into from
Closed

Conversation

Flo3-1
Copy link

@Flo3-1 Flo3-1 commented Nov 16, 2023

Description:

Fixes the decryption code for the Simens IM350 issued by Wiener Netze

It has been implemented using the define USE_IM350 to grantee compatibility with older versions and other devices.

During dry runs also solved #18560 / #18561

Checklist:

  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP32 V.2.0.14
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@gemu2015
Copy link
Contributor

i am not very happy with #define inside this driver
goal should be to have a single driver which can be configured by descriptor only

try this file:
GcmParser.cpp.zip

the author of GcmParser.cpp (ams reader) has already patched this issue.

if it works make your PR

if it should not work we may think about a special option flag

@Jason2866 Jason2866 added on hold by dev team Result - Feature request put on hold by member of development team awaiting feedback Action - Waiting for response or more information labels Nov 17, 2023
@Flo3-1
Copy link
Author

Flo3-1 commented Nov 18, 2023

It works, but the magic values used to differentiate between the different packets are awfully close to values of the payload length.
I just fear that if some thing in the packet format would be changed slightly, then the payload length might accidentally collide with the magic numbers.

@Jason2866 Jason2866 removed the awaiting feedback Action - Waiting for response or more information label Nov 18, 2023
@Jason2866
Copy link
Collaborator

As it is now, it will not be merged.

@gemu2015
Copy link
Contributor

@Flo3-1
please make a pr with this file. if there may be problems with other meters i will introduce descriptor flags when needed

@Flo3-1
Copy link
Author

Flo3-1 commented Nov 26, 2023

I have done some further testing and this code works most of the time.

@Jason2866
Copy link
Collaborator

"this code works most of the time"
Does it work or not?

@Flo3-1
Copy link
Author

Flo3-1 commented Dec 3, 2023

It works for the packets sent by my Meter, but I have found packets online by similar meters which do not decode with the if statement. But do decode witch the define due to a collision with the magic values in the code. Therefore it works on my machine, but there is a likelihood for it to not work witch a different utility company.

@gemu2015
Copy link
Contributor

@Flo3-1
please try to change these files.
i added special option A to force this IM350 mode

add this special option line to descriptor:

1,=soA,1

1 forces IM350 mode

SML.zip

@s-hadinger
Copy link
Collaborator

Any status on this PR?

@gemu2015
Copy link
Contributor

i simply added a descriptor flag to modify the drivers behavior via descriptor instead of an #ifdef.
waiting for @Flo3-1 to verify the driver with his meter.

@Flo3-1
Copy link
Author

Flo3-1 commented Dec 31, 2023

Sorry for the late comment, I was a bit busy.
I am still testing it, but so far it looks good.

@gemu2015
Copy link
Contributor

@Flo3-1

ok, since you seem to be very busy, i will do the pr since other users also requested this change.

@gemu2015 gemu2015 mentioned this pull request Jan 12, 2024
6 tasks
@dagobertch
Copy link

@gemu2015 maybe I can help, I have an IM350 from Wiener Netze, and it does not work (#8790 (comment)). Now I tried to compile a Version from the Development branch and added the 1, =soA,1 command to the Script, but decryption is not working for me…
I am realy new here, so Maybe I made something wrong and therefore it is not working…

@gemu2015
Copy link
Contributor

@dagobertch
this is no RAM issue. the SML driver has no RAM problems on ESP8266.
make sure that in dump mode there is never any garbage. if any there must be a hardware problem with IR head ( like misplacement) or serial line level with improper voltage levels (e.g. on a WEMOS device with USB UART you may not use serial RX line because the UART chip interferes with that line.

@dagobertch
Copy link

dagobertch commented Jan 14, 2024

@dagobertch this is no RAM issue. the SML driver has no RAM problems on ESP8266. make sure that in dump mode there is never any garbage. if any there must be a hardware problem with IR head ( like misplacement) or serial line level with improper voltage levels (e.g. on a WEMOS device with USB UART you may not use serial RX line because the UART chip interferes with that line.

@gemu2015 I checked again, every block of the encrypted dump starts with 7e a0 and ends with 7e and Looks Like no missing values in between.
After enabeling decryption, only every now and then a block will be decrypted and this decrypted block is wrong (compared to the decryption wich was made from gismo2004 for me) . And After a few minutes the device restarts because of the watchdog. So there seems a Problem with decryption on my device…

the dump:

13:54:14.115 CMD: Sensor53 d1
13:54:14.120 RSL: RESULT = {"Time":"2024-01-14T13:54:14","SML":{"CMD":"dump: 1"}}
13:54:14.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee cf d6 d8
13:54:14.537 : 7a 63 e1 ed 4f dc 94 74 80 f0 2b b6 0b 86 e2 d8 5a 07 a6 3a 80 ef e5 22 4d 2b 9e 77 35 1d 97 2e
13:54:14.573 : ee 94 c6 c4 87 7c 21 92 e8 23 db e6 09 73 d1 87 23 db 0a 9e 65 3b 7b 63 50 ae 83 8f dc 98 62 b0
13:54:14.646 : 28 24 77 11 1f 0d c7 92 8d c5 bb 96 08 42 ee 30 a7 d9 0e 13 4f 72 92 24 02 5d 54 04 7e
13:54:15.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d0 69 d4
13:54:15.537 : 76 9b 34 27 f0 1d b1 7e 75 8d af ed fa 27 5f 78 1a 95 01 40 79 7c 75 b8 5c 8c 37 4f a2 55 2a f3
13:54:15.573 : be 05 07 6a 8b e6 84 14 e7 ab 5e 98 16 3f af 5a 48 40 56 2a 3a 4c ae 46 81 f7 80 cc 7d e6 a8 a5
13:54:15.646 : 35 61 e4 c3 52 81 9b c1 f8 07 74 24 dd fb 93 4d fc 91 f2 4b 8d 09 6a 3a 27 d9 2a 6e 7e
13:54:16.501 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d1 1a 2f
13:54:16.537 : 70 3e a2 93 cf 2b a2 12 f2 02 ef 81 e8 35 ef 33 96 8a 3d ac a6 93 54 30 81 2b cb 6d 5f 9d 05 0d
13:54:16.574 : dd fe 73 90 ea f5 a2 76 a3 d6 11 1b ca bb 9a c2 c5 51 97 59 82 cd 50 45 59 96 53 ac 60 3b ac 2e
13:54:16.647 : 15 13 49 19 7a da 3d ea 03 8f bd 84 6d 5f 87 d2 fe 12 48 36 d3 6d 77 66 59 96 ce fa 7e
13:54:17.494 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d2 7f 11
13:54:17.530 : 26 6b 76 a8 ef f4 4a 07 db 1c 97 19 2c 61 13 4c 79 74 df 0f dc 2e 0d 4b 53 b3 d3 ac 01 29 82 c7
13:54:17.567 : a8 6b 96 65 87 13 9c 7d de 03 55 82 0c 27 2b ce 92 df fe 83 ee 83 14 fc 6f eb 41 ed 28 b6 bd 02
13:54:17.640 : b7 14 fd 57 7f 7d 9e 57 59 1f 4c b0 5d 24 57 56 d6 6c af 5c e2 8e d7 94 2c 8b b4 72 7e
13:54:18.502 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d3 e1 1d
13:54:18.536 : 3d 2a 5f d5 e8 d3 94 e1 3e 39 bb e4 ff 2c 95 40 8d 93 be f3 3b a2 83 53 6b d9 d6 a6 d6 ae c4 9d
13:54:18.573 : 15 0e 6f 78 b4 b3 47 90 b1 66 7d 04 09 ed da df 50 4c d6 de da 6e 0d 05 6a c5 7a f8 3a 33 bd 99
13:54:18.646 : 4a 6f f4 86 7a d7 57 31 2f c0 3b ba 08 cc da 48 a8 fb 0c 7a 79 ee 87 a1 92 13 ec 82 7e
13:54:19.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d4 07 3a
13:54:19.535 : da 3e 42 1d 29 e2 2b de 20 86 85 8d 34 dc ff dc 6c 6f bf c9 8e 36 c4 74 6d b0 d0 8a 6f f0 60 2f
13:54:19.572 : fc 09 5b 06 4d 80 03 d4 9d 6c 30 79 e7 5f 3d 44 5d 39 18 43 3b 40 3e 5b 14 75 fb 1e 1b ea c5 1f
13:54:19.645 : 71 52 5e c0 d8 24 67 cf 9f b5 65 11 34 be 40 67 2b bf 72 87 fa f3 c4 a2 fa e9 33 b7 7e
13:54:20.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d5 66 f6
13:54:20.536 : 86 d7 17 45 79 3c 17 71 ed b0 7f 1c e1 88 8f 06 ba d4 44 74 5c 5e d7 43 15 9a cc 2e c9 17 a1 56
13:54:20.573 : 90 3c 52 9b 9c d2 63 4c ed c2 94 de 14 72 a3 39 66 f6 dc b9 7d 2b c5 14 e1 c6 ef f0 6d 8a 85 91
13:54:20.646 : a6 be 00 b5 1d 64 ab c3 50 68 b1 41 09 44 9a 2d a5 a2 b8 10 d5 18 33 82 3f 81 ee e5 7e
13:54:21.501 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d6 f8 0a
13:54:21.537 : 20 34 69 1b 29 75 c7 41 97 d9 60 7f dd be 6f 82 0c a1 7c dc 79 40 0c 95 06 3d 08 7a b3 b5 f6 44
13:54:21.574 : 0f b6 a8 81 2e 54 8e bb b8 e2 a9 81 69 aa e9 f1 b6 15 5a 7b 1d 0a ac cb b6 05 52 31 d0 e0 ad 14
13:54:21.647 : bb e3 33 36 b3 1a 52 76 5f a9 e3 cc 21 3c 33 ad 79 67 11 60 f2 d5 0b a4 a0 31 3a 01 7e
13:54:22.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d7 f3 89
13:54:22.537 : 24 d7 85 ea 99 6a e4 ad 54 49 3a 02 6b 67 2e c3 2c 9a 70 85 19 43 53 b3 76 e9 c0 a2 f6 23 6e ab
13:54:22.574 : 08 c2 d7 01 7e 99 f2 e4 c7 d3 17 cc da b0 a0 ab 31 73 26 3d a5 62 0b b0 ba 98 d3 7a 22 9f 4c 58
13:54:22.647 : 35 27 c4 4f ee 5e bd da 29 b5 f3 e8 cb 55 96 c2 12 d7 92 a2 56 6f c7 2a f5 2f c3 08 7e
13:54:23.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d8 ea 8d
13:54:23.536 : 63 5d 45 fe 7c f1 d9 f4 e9 6e fd fa d9 7f 3d 40 17 b6 db 90 b8 e7 5f 1a 1b c5 70 fb 0e 1a 24 db
13:54:23.573 : b2 74 d1 bb e0 bb 5d 27 89 e0 64 be c6 e2 b4 34 89 da ff 15 20 9e a2 02 8d af 87 96 72 64 ec c9
13:54:23.646 : 05 17 be 68 cf 61 58 8f 25 f1 43 93 df fc ab 12 6f 7c 84 e1 b3 73 be 09 d4 7c 59 48 7e
13:54:24.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee d9 51 e1
13:54:24.536 : 71 4a 81 27 83 79 10 08 97 df 4b 45 cf c1 af 0c 07 57 21 9c 42 68 40 fc 4a 74 97 6c c4 0b d4 27
13:54:24.573 : 8c 1b 0d e7 81 8f 97 2d d7 b9 3e af 57 65 f7 0a ae a5 00 db 55 d6 52 88 db 7a 54 b6 6e 45 fb 5c
13:54:24.646 : 19 66 a7 18 79 63 e7 a9 0c d7 e7 08 4e 45 d7 35 9f 3c 82 9d 7d bd 2b 4a 08 42 27 34 7e
13:54:25.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee da 91 3d
13:54:25.536 : b1 7d e1 72 f2 ea 2b 2c f4 e6 ee 70 7d b0 19 eb 2d 9a b2 ba dc f3 56 32 2f ae cd 35 21 0a bd e7
13:54:25.573 : 61 a9 56 f6 70 9f 38 d2 c6 46 f8 97 58 71 9c 89 24 c7 13 ed 3a 01 68 02 28 6d 1c ad ab c7 86 7b
13:54:25.646 : 95 60 fd 62 f5 32 d1 b3 62 53 59 2f 4b de 45 e9 07 59 fc 0c 8a 27 73 e9 60 5d d4 0c 7e
13:54:26.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee db 92 2f
13:54:26.537 : d0 9a 8f c6 31 ec ac e6 fb 8a 64 4f 61 78 f8 fa f3 3b 61 98 f0 7b 9e ef cb 73 55 7e 9d 5d 52 2a
13:54:26.574 : da ab f2 dd 0c 4d b3 8d ba a1 3f c9 0f ea 13 8c 36 72 7c 60 8b 42 48 0c f7 3c 65 22 b7 97 bf 6f
13:54:26.647 : 11 c2 b3 e6 3d d2 c0 5b 73 02 3a 3f ba 94 01 84 cc 01 f6 f2 3b 2f 00 9d 66 9c 26 a6 7e
13:54:27.492 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee dc 88 7c
13:54:27.529 : 32 73 88 6a 34 3f 1c c9 5b f5 5d ab ab 32 a2 cd 96 b3 9c ce 9c 96 b5 a4 a0 f4 fa f3 d8 65 27 9a
13:54:27.566 : 2e d2 26 40 97 5a 0e 1a 11 b4 82 79 1d 17 d0 04 81 a1 10 34 c7 ae 87 a9 c5 c9 74 e0 13 02 9e 92
13:54:27.639 : 3a d2 2f 56 e7 6f ad cf c6 46 a0 e5 51 18 f3 bf 2c e7 63 47 7d 09 c3 3c 0f 01 5a f2 7e
13:54:28.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee dd 37 df
13:54:28.536 : bb 89 c9 ce c4 c7 71 6f 48 8f a2 af 4e 3a 72 fb 57 59 d5 c2 95 e6 bb 80 e8 b8 35 4f fc 33 44 b8
13:54:28.573 : c4 df 3b 9f c2 6d e3 69 c4 fe f2 1e f7 1a 99 9c 0f 46 6e ad b1 d8 a0 e3 fd 4f 09 f2 81 d9 67 a6
13:54:28.646 : 10 dc 8d 23 83 b3 77 e8 56 0a 12 0a 4f af ba 9f 0b ee cd c9 1a fc b1 c9 ef 2f 80 9d 7e
13:54:29.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee de 8c 92
13:54:29.536 : 7c 0f bb 8d 8e 5f 53 22 d8 9c 99 c3 0d cb 58 d7 94 61 3a 0e 36 6b 58 c7 c3 11 52 af ab 50 ac 58
13:54:29.573 : 0f 12 9b 3a bb 4b 40 04 8f 4f c7 e5 ca 46 d9 4b 18 90 3b de 18 a4 8c 8a 58 07 31 c6 70 5c 43 4a
13:54:29.646 : 4d 70 61 04 9b 03 38 79 be 33 a6 3f e3 2d 6a 8a 67 e7 13 39 c8 7d ce 57 c0 09 3b 19 7e
13:54:30.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee df e1 cf
13:54:30.536 : 3a 8c 8d 3b cb 2f 93 8b c6 0c b4 7b ce c6 04 ea b1 85 78 d6 89 c3 a4 2d 44 9d e3 0a 58 b5 09 46
13:54:30.572 : 4c cb 65 0b f0 a6 62 cb bd b3 f3 85 a3 87 7d de c5 66 56 e9 ea c3 40 7e 0c b2 92 b9 31 67 a7 65
13:54:30.646 : 5f 00 f6 2b 48 e0 46 09 ac 91 df 57 86 42 26 f2 da 56 05 1d 12 58 3d d1 be 9a 35 9a 7e
13:54:31.500 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee e0 f8 a2
13:54:31.537 : c4 16 5b b5 94 7c d5 d9 39 ee 66 88 80 9f 61 81 65 a4 89 80 b9 66 47 a2 67 ee 5c bc 97 ec fc 67
13:54:31.573 : cc 96 28 e5 07 71 df 6a de 00 72 04 a5 70 38 9a 80 f7 34 88 92 3d b3 95 95 9b 5c de ff 11 98 28
13:54:31.647 : 84 08 f8 77 5c 91 fe 25 7f 13 68 d3 a8 6c b9 59 71 e1 29 3b 71 26 2f c5 96 bd 60 e9 7e
13:54:32.491 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee e1 8d c6
13:54:32.528 : 97 7b 55 fb 3e 93 35 ca 2f 80 3f 21 aa 4d 8c f3 c4 eb 5d a8 ad 63 7e fe 4d f9 ff 0b 43 d3 eb 37
13:54:32.564 : 95 74 aa 84 c8 1f 78 a3 5b 25 59 c7 d0 6d 1e 51 e1 2e ec 18 33 71 11 b2 ae 8d e1 69 cd 73 06 7f
13:54:32.637 : 38 fa 3c 91 71 74 c6 b0 68 0c 2f 8a fa 71 d1 5c ed 6d 67 07 d2 2c 21 7b 1e 00 21 a2 7e
13:54:33.499 : 7e a0 7b cf 00 02 00 23 13 62 b1 e6 e7 00 db 08 53 4d 53 67 70 04 52 cd 61 20 00 06 ee e2 0a 93
13:54:33.536 : b8 ac 13 8d 9d 80 45 6a a5 3f cb ef 89 82 9f df 4b 30 a9 2c cb 91 e3 d6 b4 da d8 b9 b1 81 2e 91
13:54:33.573 : 2b 48 f1 0e 1e af dc cf ba 31 28 0b a4 2b b2 b8 00 50 9c 84 c2 ce 54 c6 83 af ce 82 2a 5e d7 49
13:54:33.646 : e7 27 7c fa 6c d9 9f e5 f9 3b f1 87 1a f3 85 d8 e9 30 98 a0 ad 5f 81 23 05 ab 06 ee 7e
13:54:33.660 CMD: Sensor53 d0
13:54:33.665 RSL: RESULT = {"Time":"2024-01-14T13:54:33","SML":{"CMD":"dump: 0"}}

edit: enabeling logging Shows:
14:11:56.232 SML: HDLC frame:
14:11:56.233 SML: LLC frame:
14:11:56.236 SML: GCM frame:
14:11:56.238 SML: Ended up in default case while unwrapping...(tag EF)
14:11:56.240 SML: Unknown data payload:
14:11:56.338 HTP: Main Menu
14:11:57.231 SML: HDLC frame:
14:11:57.233 SML: LLC frame:
14:11:57.236 SML: GCM frame:
14:11:57.238 SML: Ended up in default case while unwrapping...(tag 9D)
14:11:57.240 SML: Unknown data payload:
14:11:58.231 SML: HDLC frame:
14:11:58.233 SML: LLC frame:
14:11:58.236 SML: GCM frame:
14:11:58.238 SML: Ended up in default case while unwrapping...(tag CB)

@gemu2015
Copy link
Contributor

ok, then if your raw data is ok, is your input buffer large enough , default is 48 Bytes but you need much more.
what firmware do you use, what is your descriptor ?
read the docs about input buffers (special options)

@dagobertch
Copy link

dagobertch commented Jan 15, 2024

Oh no, seems I found the Solution: I wrote 1,=so4, key not 1,=so4,key
I had a blank before the key 🤦🏻
Tried now with different Firmware-Versions: only works with the latest Development Version 13.3.0.3, but there also without the new Special Option soA
Working on ESP32 and ESP8266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants