Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

Author Topic: Read electricity meter Iskra MT631  (Read 310 times)

• Full Member
• Posts: 106
Read electricity meter Iskra MT631
« on: June 24, 2022, 07:59:47 pm »
Has anyone created code in Pascal to read one of the new smart electricity meters yet?
Here it is in Python
Unfortunately I am not yet completely through how I "decode" the values, i.e. momentary consumption etc.
Amstrad Schneider CPC 6128
Wind XP / 7 / 10

MarkMLl

• Hero Member
• Posts: 4760
Re: Read electricity meter Iskra MT631
« Reply #1 on: June 24, 2022, 10:25:13 pm »
Take a look at Github: there are several relevant projects.

MarkMLl

p.s. Hint: Github, Hackaday and so on have their own search facilities which you can use as Mozilla extensions. If necessary install the Mycroft Project's extension first, since it apparently provides a useful bridge between APIs.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

y.ivanov

• Sr. Member
• Posts: 444
Re: Read electricity meter Iskra MT631
« Reply #2 on: June 24, 2022, 10:58:17 pm »
Has anyone created code in Pascal to read one of the new smart electricity meters yet?
Here it is in Python
Unfortunately I am not yet completely through how I "decode" the values, i.e. momentary consumption etc.

It looks fairly well documented. But I don't speak German. Looking at Python sources I can see that
the values are taken from a fixed offsets in the message:

Code: Python  [Select][+][-]
1. if message[0:8] == '\x1b\x1b\x1b\x1b\x01\x01\x01\x01':
2.                         watchdog.stop()
3.                         AB_Wges = round((int(message[150:158].encode('hex'),16)*0.0001),4)
4.                         AB_Pges = (int(message[294:298].encode('hex'),16))
5.                         AB_PL1 = (int(message[314:318].encode('hex'),16))
6.                         AB_PL2 = (int(message[334:338].encode('hex'),16))
7.                         AB_PL3 = (int(message[354:358].encode('hex'),16))
8.                         mystring=""
9.                         result={"AB_Pges": AB_Pges,"AB_PL1": AB_PL1,"AB_PL2": AB_PL2,"AB_PL3": AB_PL3,"AB_Wges": AB_Wges}
10.                         with open('/mnt/RAMDisk/AB.json', 'w') as file:
11.                                 json.dump(result, file)
12.

Which is not a good practice, though. Some field can go wider and trash the result. Also, I can see some scaling parameters, which are not taken into account, assumed as fixed (AB_Wges=round(int(...)*0.0001),4)), others probably assumed as 1.

I can find something similar at: https://github.com/boernhart/smart-meter-logger, but a bit smarter - it looks for some signatures "looking for OBIS Code: 1-0:1.8.0*255", again scaling pre-assumed.

What exactly needed? Baked Pascal sources?
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000