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.
https://www.stefan-weigert.de/php_loader/sml.php
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:
if message[0:8] == '\x1b\x1b\x1b\x1b\x01\x01\x01\x01':
watchdog.stop()
AB_Wges = round((int(message[150:158].encode('hex'),16)*0.0001),4)
AB_Pges = (int(message[294:298].encode('hex'),16))
AB_PL1 = (int(message[314:318].encode('hex'),16))
AB_PL2 = (int(message[334:338].encode('hex'),16))
AB_PL3 = (int(message[354:358].encode('hex'),16))
mystring=""
result={"AB_Pges": AB_Pges,"AB_PL1": AB_PL1,"AB_PL2": AB_PL2,"AB_PL3": AB_PL3,"AB_Wges": AB_Wges}
with open('/mnt/RAMDisk/AB.json', 'w') as file:
json.dump(result, file)
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?