The idea of messageToXml method is to visualize the received frame as XML. It's not planned that you can use it later because there are values that are changing every time.
I understand your idea in the push message. I believe that you want to search for values from the comments and save them. I propose that you use getData of the GXDLMSClient. You can get the example from here:
hi, thx for the fast answer, unfortunate i don't use GXDLMSClient
i use only GXDLMSTranslator to decrypt my message,
the data message i get every second via serial from my siemens im350 smartmeter
use a esp8266 for readout and forward it to tcp, see: https://github.com/xeniter/eww_ewerk_wels_smartmeter_readout
example of decoding one message:
data = "7ea070cf0002002313e0c7e6e700db08534d53677002dfe956200002825507e4a90965d819af74e8e8325aca4d00b0df6b9d3b7f847f95dee24ca51c883641b7be98bc52c07a2d7bee229244a6ccea7cf7130ccdba5c35eae2caa1ea379879eb672fd78b494d6136bc9ad7fba61ff29b3b7e"
xml = ""
# decrypting received data
#decrypt = GXDLMSTranslator(TranslatorOutputType.STANDARD_XML)
decrypt = GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML)
decrypt.comments = True
decrypt.security = enums.Security.ENCRYPTION
decrypt.blockCipherKey =GXByteBuffer.hexToBytes("75FD8711381B3FB18C101AEBD192C3AB")
xml = decrypt.messageToXml(GXByteBuffer.hexToBytes(data))
print(xml)
Goal would be here to parse values from the xml result and forward/push it for example somehow to home assistent, however when parsing it i get a xml parse error cause of comments in comments xml.
Will try maybe simple regex for parsing but this is more like workaround instead reading valid xml with a parser.
I was thinking about this and it's possible to start using #comment if there are internal comments. That will solve your problem. Testing will take some time, but this will be released next week after the new version from Gurux.DLMS.AMI is released.
Hi,
Hi,
The idea of messageToXml method is to visualize the received frame as XML. It's not planned that you can use it later because there are values that are changing every time.
I understand your idea in the push message. I believe that you want to search for values from the comments and save them. I propose that you use getData of the GXDLMSClient. You can get the example from here:
https://github.com/Gurux/Gurux.DLMS.Python/blob/340f98a30a9a4095256ae29…
BR,
Mikko
hi, thx for the fast answer,
hi, thx for the fast answer, unfortunate i don't use GXDLMSClient
i use only GXDLMSTranslator to decrypt my message,
the data message i get every second via serial from my siemens im350 smartmeter
use a esp8266 for readout and forward it to tcp, see:
https://github.com/xeniter/eww_ewerk_wels_smartmeter_readout
example of decoding one message:
data = "7ea070cf0002002313e0c7e6e700db08534d53677002dfe956200002825507e4a90965d819af74e8e8325aca4d00b0df6b9d3b7f847f95dee24ca51c883641b7be98bc52c07a2d7bee229244a6ccea7cf7130ccdba5c35eae2caa1ea379879eb672fd78b494d6136bc9ad7fba61ff29b3b7e"
xml = ""
# decrypting received data
#decrypt = GXDLMSTranslator(TranslatorOutputType.STANDARD_XML)
decrypt = GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML)
decrypt.comments = True
decrypt.security = enums.Security.ENCRYPTION
decrypt.blockCipherKey =GXByteBuffer.hexToBytes("75FD8711381B3FB18C101AEBD192C3AB")
xml = decrypt.messageToXml(GXByteBuffer.hexToBytes(data))
print(xml)
Goal would be here to parse values from the xml result and forward/push it for example somehow to home assistent, however when parsing it i get a xml parse error cause of comments in comments xml.
Will try maybe simple regex for parsing but this is more like workaround instead reading valid xml with a parser.
Hi,
Hi,
I was thinking about this and it's possible to start using #comment if there are internal comments. That will solve your problem. Testing will take some time, but this will be released next week after the new version from Gurux.DLMS.AMI is released.
BR,
Mikko