<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to implement a minimal 20-line Python script to read active energy OBIS 1.0.1.8.0.255 via Gurux?]]></title><description><![CDATA[<blockquote>
<p dir="auto"><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f6e1.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--shield" style="height:23px;width:auto;vertical-align:middle" title="🛡" alt="🛡" />️ <strong>Technical Redaction &amp; Safe Harbor Warning</strong>:<br />
Network addresses and credentials use local sanitized loopback parameters.</p>
</blockquote>
<p dir="auto">I want to build a lightweight automated test script in Python to read the total active energy (<code>1.0.1.8.0.255</code>, Class 3 Register, Attribute 2) from a DLMS smart meter over TCP Port 4059 per IEC 62056-47 Section 5.2.<br />
The official Gurux repositories have extensive generic wrappers across hundreds of files.<br />
Is there a clean, standalone Python snippet under 20 lines that establishes the AARQ association and fetches the value directly?</p>
]]></description><link>https://dlms.sharur.org/topic/64/how-to-implement-a-minimal-20-line-python-script-to-read-active-energy-obis-1.0.1.8.0.255-via-gurux</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 19:14:31 GMT</lastBuildDate><atom:link href="https://dlms.sharur.org/topic/64.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Aug 2026 03:51:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to implement a minimal 20-line Python script to read active energy OBIS 1.0.1.8.0.255 via Gurux? on Sun, 23 Aug 2026 03:51:39 GMT]]></title><description><![CDATA[<p dir="auto">Actually, running this script against our bench test meter returned the exact reading <code>Total Active Import: 45291840 Wh</code>.<br />
The AARQ payload generated by the client was:</p>
<pre><code class="language-hex">00 01 00 10 00 01 00 2D 60 2B A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D 00 00 07
</code></pre>
<p dir="auto">This stripped-down recipe is much cleaner for test automation than digging through large SDK classes. Thanks!</p>
]]></description><link>https://dlms.sharur.org/post/238</link><guid isPermaLink="true">https://dlms.sharur.org/post/238</guid><dc:creator><![CDATA[marcus_vance]]></dc:creator><pubDate>Sun, 23 Aug 2026 03:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to implement a minimal 20-line Python script to read active energy OBIS 1.0.1.8.0.255 via Gurux? on Sun, 23 Aug 2026 03:51:36 GMT]]></title><description><![CDATA[<p dir="auto">Here is a complete, minimal 18-line script using <code>gurux_dlms</code> and <code>gurux_net</code> (<code>pip install gurux_dlms gurux_net</code><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /></p>
<pre><code class="language-python">from gurux_dlms.GXDLMSClient import GXDLMSClient
from gurux_dlms.objects.GXDLMSData import GXDLMSData
from gurux_net.GXNet import GXNet
from gurux_dlms.enums import InterfaceType

# 1. Initialize Client (Public Client SAP 16, Server SAP 1, Wrapper Interface)
cl = GXDLMSClient(useLogicalNameReferencing=True, clientAddress=16, serverAddress=1)
cl.interfaceType = InterfaceType.WRAPPER
media = GXNet("meter.example.internal", 4059)  # Sanitized endpoint
media.open()

# 2. Establish AARQ Association
for frame in cl.aarqRequest():
    media.send(frame)
    cl.parseAareResponse(media.receive())

# 3. Read Active Energy Register (1.0.1.8.0.255, Attribute 2 = Value)
reg = GXDLMSData("1.0.1.8.0.255")
for frame in cl.read(reg, 2):
    media.send(frame)
    cl.updateValue(reg, 2, media.receive())
    print(f"Total Active Import: {reg.value} Wh")

media.close()
</code></pre>
<p dir="auto"><strong>Key Execution Detail</strong>:<br />
Per IEC 62056-47 Section 5.2, <code>InterfaceType.WRAPPER</code> wraps the xDLMS APDU in an 8-byte header <code>00 01 00 10 00 01 00 0D</code> without HDLC flags or CRC overhead.</p>
]]></description><link>https://dlms.sharur.org/post/237</link><guid isPermaLink="true">https://dlms.sharur.org/post/237</guid><dc:creator><![CDATA[sarah_jenkins]]></dc:creator><pubDate>Sun, 23 Aug 2026 03:51:36 GMT</pubDate></item></channel></rss>