S
sharur_gate2_admin
@sharur_gate2_admin
My Replies & Activity
Track and review all technical solutions, peer debates, and answers you have contributed to the community.
2026-11-30T03:27:29.122Z
<p dir="auto">Welcome to <strong>Sharur</strong> (<code>dlms.sharur.org</code>), an open engineering community dedicated to <strong>DLMS / COSEM</strong>, <strong>IEC 62056</strong>, smart metering, OBIS data modeling, and energy protocol interoperability.</p>
<h3>Moderation Update</h3>
<p dir="auto">We recently removed a wave of automated off-topic promotional posts from the <strong>Announcements</strong> category and suspended the offending accounts. The community feed has been restored to active DLMS / COSEM technical discussions.</p>
<h3>Community Posting Guidelines</h3>
<ol>
<li><strong>Keep Discussions On-Topic</strong>: Please post technical questions, protocol traces, firmware issues, and implementation discussions in <strong>General Discussion</strong> (<code>cid: 2</code>), and keep topics focused on energy engineering and metering protocols.</li>
<li><strong>Zero Tolerance for Spam</strong>: Automated posting, off-topic content, and commercial SEO backlinks are prohibited and will be removed immediately along with permanent account suspension.</li>
<li><strong>Protect Sensitive Data</strong>: Before posting packet captures or logs, remove cryptographic keys, passwords, meter identifiers, private hosts, and customer details.</li>
<li><strong>Report Issues</strong>: If you spot spam or off-topic posts, please flag them so moderators can review and act promptly.</li>
</ol>
<p dir="auto">Thank you for helping keep Sharur a high-signal resource for smart metering and energy protocol engineering.</p>
2026-08-22T06:18:41.667Z
<p dir="auto">For production code, return offsets with each error so a 400-byte trace does not force operators to count bytes manually.</p>
2026-08-22T06:18:41.555Z
<p dir="auto">Keep the structure description beside the payload in test evidence. Without it, a compact array cannot be decoded unambiguously.</p>
2026-08-22T06:18:41.387Z
<p dir="auto">The parser below is intentionally small and defensive. It rejects trailing bytes instead of guessing a schema.</p>
<pre><code class="language-python">def decode_compact_array(payload: bytes, widths: list[int]) -> list[list[bytes]]:
row_width = sum(widths)
if row_width == 0 or len(payload) % row_width:
raise ValueError("payload does not align with the synthetic schema")
rows = []
for offset in range(0, len(payload), row_width):
cursor = offset
row = []
for width in widths:
row.append(payload[cursor:cursor + width])
cursor += width
rows.append(row)
return rows
</code></pre>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Column</th>
<th style="text-align:right">Width</th>
<th>Synthetic meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>timestamp</td>
<td style="text-align:right">12</td>
<td>octet string</td>
</tr>
<tr>
<td>active energy</td>
<td style="text-align:right">4</td>
<td>unsigned</td>
</tr>
<tr>
<td>status</td>
<td style="text-align:right">1</td>
<td>bit flags</td>
</tr>
</tbody>
</table>
2026-08-22T06:18:41.277Z
<p dir="auto">Only retry transport-class failures. An authenticated COSEM denial should be returned to the caller with its decoded result, not silently retried.</p>