-
Notifications
You must be signed in to change notification settings - Fork 2
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
panic: runtime error: index out of range [651] with length 648 #1
Comments
Hi Michael, as I mentioned in the description, the Code was written for this smart meter -> https://emh-metering.com/produkte/haushaltszaehler-smart-meter/ehz-k/ You can try extracting the data manually like https://www.schatenseite.de/2016/05/30/smart-message-language-stromzahler-auslesen/ and compare them with the output of the code (add some debug messages). |
Thanks, Daniel. First of all thanks for developing these awesome pieces of code. I'm a GO programming beginner so I was happy to find your stuff. I do find those three patterns within my SML-String and can also find the values for them. But as I said, I'm a GO beginner, so I'm not able to understand your code good enough to modify it. Especially the concepts behind your "...Strategy" modules. |
First, I splitted your bytes to see the complete (or almost complete) SML-Message. I left some comments for a better understanding.
The first part is not relevant (at least not relevant for us). After ---- begins the fun. I added the strategies to easily test, extend and create new "value readers". On creation of the MessageBody all strategies are initialized. If you need a new one, add it to the initializeStrategies method. Now have a look at the ManufacturerValueStrategy.go.
Every strategy has a OBIS_T_ID variable. In ManufacturerValueStrategy.go for example -> So if you change the OBIS-Code of CurrentValueStrategy.go you should get the current value of your smart meter. Or you can easily add (or remove) strategies to read other values. In MessageBody.go line 44 I extract one Block at a time, iterate over all strategies and check if one strategy can handle this Block, if not i move to the next block. I'm sorry, its late and some parts may be confusing. Ask if you have some questions. |
You can test the code with your string-byte-example -> |
Closed due to no activity. Feel free to write me if you want to continue the discussion :) |
I tried to use your code with my Hager EHZ 363Z5 over TCP (modified the code a little). When using the following SML I get a "index out of range":
local/energyreader/sml/MessageBody.(*MessageBody).moveBytePointerToNextListEntry(0xc000132000)
sml/MessageBody/MessageBody.go:66 +0x9c
It says "found packet", but then the error occurs.
SML-String:
1B1B1B1B01010101760900000000255BED44620162007263010176010109000000000C73F9CC0B0648XXXXXX7527B010163953100760900000000255BED45620162007263070177010B06XXXXXXX527B070100620AFFFF726201650F4B602DF17977078181C78203FF01010101044841470177070100000009FF010101010B0648XXXXXX37527B0177070100010800FF628201621E52FF552354F20201770781F6AFACFAFACF621E52FF552354CAF2DE0177070100010802FF0101621E52FF5327100177070100020800FF628201621E52FF552BD5A0E10177070100020801FF0101621E52FF552BD579D10177070100020802FF0101621E52FF5327100177070100100700FF0101621B520053094C0177070100240700FF0101621B52FF53214601770701001F0700FF0101622152FE5301BE0177070100200700FF0101622352FE5356D30177070100380700FF0101621B52FF5316240177070100330700FF0101622152FE53011B0177070100340700FF0101622352FE53576A01770701004C0700FF0101621B52FF5324B40177070100470700FF0101622152FE5301B30177070100480700FF0101622352FE5355920177070100603200020101620952FF5301360177078181C78205FF010101018302BF093F6DE4D2CA3E3C2C04CCB9XXXXXXXXXX5192CDD4FF49296500DE1DAE8CF536160F9070AFD0FF0BE2FFC5834EAC0177070100603203030101622352006268017707010060320304010162235200630117017707010060320003010162095200520A017707010060320004010162095200522B017707010060320005010162095200520401010163812200760900000000255BED3E620162007263020171016338BA00001B1B1B1B1A019AD7
any idea?
The text was updated successfully, but these errors were encountered: