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

Use shm-et340 with SMA Energy meter (SHM1.0) #7

Open
hoschult opened this issue Aug 22, 2022 · 6 comments
Open

Use shm-et340 with SMA Energy meter (SHM1.0) #7

hoschult opened this issue Aug 22, 2022 · 6 comments

Comments

@hoschult
Copy link

Hi,
tried to use your code with my SMA Energy meter (SHM1.0). Seems to be working - at least partly:

DEBU[0019] Received datagram from meter                 
DEBU[0019] Uid: 262816                                  
DEBU[0019] Serial: xxxxxx                           
DEBU[0019] Total W: -7757.2                             
DEBU[0019] Total Buy kWh: 18513.638899999998            
DEBU[0019] Total Sell kWh: 32970.4046                   
INFO[0019] Meter update received: 18513.64 kWh bought and 32970.40 kWh sold, -7757.2 W currently flowing 
DEBU[0019] +-----+-------------+---------------+---------------+ 
DEBU[0019] |value|   L1 	|     L2  	|   L3  	|          
DEBU[0019] +-----+-------------+---------------+---------------+ 
DEBU[0019] |  V  |     1.00 	|     1.00 	|     1.00 	|  
DEBU[0019] |  A  |    -1.70 	|     1.30 	|    -0.70 	|  
DEBU[0019] |  W  |    -1.70 	|     1.30 	|    -0.70 	|  
DEBU[0019] | kWh | 1721346537.27 	| 3285096407.88 	| 4848846278.50 	| 
DEBU[0019] | kWh | 1799534030.79 	| 3363283901.41 	| 4927033772.02 	| 
DEBU[0019] +-----+-------------+---------------+---------------+ 

UID, Serial and 'Total W' are correct; V/A/W seems to be not decoded correctly (neither for any phases). Tried to look at the datagrams to be captured of speedwire multicast: https://github.com/datenschuft/SMA-EM/blob/master/speedwiredecoder.py - However I was not able to translate towards your code....

Are you foresee to implement also the readings of SHM1.0 (SMA Energy meter)? That would be fantastic.... I can offer my help by supporting the tests.

Thanks,
Holger

@hoschult
Copy link
Author

there is a guy at victron community stating the following:

I have used your GIT hub code to hack my SMA EM v1 to work on this. There is essentially a 4 byte offset on the decodePhaseChunks.

@hoschult
Copy link
Author

hoschult commented Sep 4, 2022

... found a explanation for the 4 byte offset; SHM2 takes also grid frequency into account, SHM1 does not. According to a specification of the speedwire datagram (found at https://openwb.de/forum/viewtopic.php?p=51576 ), grid frequency is at position 160-163:

image

@hoschult
Copy link
Author

hoschult commented Sep 4, 2022

Got meter working with SMA EM (SHM1); Need to put an offset at decodePhaseChunks in main.go

L1 := decodePhaseChunk(b[156:300]) L2 := decodePhaseChunk(b[300:444]) L3 := decodePhaseChunk(b[444:588])

That's it.... At least for my setup. To do that in a more general way, offset can be determined on the Revision of the EM; Needs to be investigated since which revision frequency (offset) need to be added (or removed).

@brezel1965
Copy link

I also have an SMA Energy Meter and my consumption is incorrect. Unfortunately I don't understand how to write this offset in main.go and compile it, maybe someone can provide the modified shm-et340. Thank you Martin

@hoschult
Copy link
Author

hi Martin. I compiled you the shm10 binary, see download link attached: https://magentacloud.de/s/EdWHd267ffLLkZf

@buttermaker11111
Copy link

Hello Holger,
can you provide the modified shm-et340 again? Under the link is no file anymore.

Thanks
Olaf

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

3 participants