Skip to content

Decode the 22-field Iskra AM550 frame from Elektro Celje - #1336

Merged
gskjold merged 1 commit into
mainfrom
fix/iskra-celje-22-field
Dec 4, 2026
Merged

gskjold merged 1 commit into
mainfrom
fix/iskra-celje-22-field

Conversation

@gskjold

@gskjold gskjold commented Nov 26, 2026

Copy link
Copy Markdown
Member

Why

An Iskra AM550 on the Elektro Celje grid (Slovenia) alternates between two unencrypted frames every second (#1332):

  • a 9-field frame led by the ISK… logical device name, which is decoded
  • a 22-field frame led by a 12-character serial, which isn't

The 22-field frame has no ISK prefix, so it doesn't take the ISK branch. Once the 9-field frame has set the meter type to Iskra, it enters the useMeterType == AmsTypeIskra block. That block only knows lengths 0x21, 0x1C and 0x0F, so 0x16 drops to the positional fallback. The fallback starts at field 5 and reads every field as 4 bytes:

  • import power came from 4.8.0 (00 A4 39 B4 = 10,762,676 W)
  • export power came from the 2-byte frequency plus the next field's first two bytes (13 85 12 04 = 327,488,004 W)
  • every counter was shifted one field, so the import counter took 4.7.0 and the export counter took 1.8.0

These are exactly the spikes the reporter saw in the UI and Home Assistant. The reporter's analysis was confirmed against their Telnet log (98 frames, strictly alternating).

Changes

  • New 0x16 branch in the Iskra block. It is guarded on field 10 being LongUnsigned and field 17 being DLongUnsigned, and decodes by position:

    Fields Meaning
    1 serial → meter ID
    2–5 1.7.0, 2.7.0, 3.7.0, 4.7.0
    6–9 1.8.0, 2.8.0, 3.8.0, 4.8.0
    10 14.7.0 frequency (skipped, no field for it)
    11–13 L1–L3 current
    14–16 L1–L3 voltage
    17–22 per-phase import and export power

    The branch calls apply(state) first, like the ISK 9-field branch does. Without it, the tariff counters (which only the 9-field frame carries), the list ID and the meter ID would be zeroed every other second.

  • 9-field ISK frame (DLongUnsigned variant): read 1.8.1/1.8.2 and 2.8.1/2.8.2 instead of skipping them as unknown. They sum exactly to 1.8.0 and 2.8.0 in both this capture and the Elektro Ljubljana fixture gh869-6, so the layout is the same there.

How the mapping was checked

  • 1.7.0 (2647 W) = 21.7.0 + 41.7.0 + 61.7.0 (2404 + 192 + 51)
  • 1.8.0 is 1 Wh above the 9-field frame sent one second earlier, and 2.8.0 is identical in both
  • L1 current × voltage matches L1 power: 2404 W ÷ 229.7 V ≈ 10.48 A

Some of the mapping is less certain:

  • The order of fields 4/5 (3.7.0 before 4.7.0) follows the other Elektro Celje fixture, gh615-8.
  • Fields 8/9 as 3.8.0/4.8.0 are plausible, but nothing in the frame confirms them.

Verification

  • New fixtures gh1332-1.hex and gh1332-2.hex: the two anonymized frames from the issue.
  • New test test_iskra_am550_slovenia_celje_22:
    • decodes 9-field → 22-field → 9-field and checks power, counters, tariffs, per-phase values and meter ID after each frame
    • checks the tariff counters of gh869-6
  • The test failed before the change and passes after it. The golden sweep is unchanged except for the two new fixture rows; gh1332-2 alone decodes to nothing, as on a device that hasn't seen the 9-field frame yet.
  • pio test -e native passes: 27 passed, 6 skipped (encrypted fixtures, no keys locally).
  • pio run -e esp8266 builds.
  • Not tested on a device or against the reporter's meter.

Refs #1332

🤖 Generated with Claude Code

The meter alternates a 9-field frame led by the ISK logical device name
with a 22-field frame led by a 12-character serial. Once the 9-field
frame had marked the meter as Iskra, the 22-field frame fell through to
the positional fallback, which read the 4.8.0 register as import power
and a 2-byte frequency plus the next field as export power, and shifted
every counter by one. Readers reported jumps to 10.7 MW import and
327 MW export, and import/export energy swapped every other second.

Decode the 22-field frame by position: power, the four energy totals,
per-phase current, voltage and active power. It starts from the stored
state so the tariff registers, which only the 9-field frame carries,
are kept.

The 9-field frame skipped the 1.8.1/1.8.2 and 2.8.1/2.8.2 fields as
unknown. They are the tariff registers (they sum to 1.8.0 and 2.8.0 in
this capture and in the Elektro Ljubljana one from #869), so read them.

Refs #1332

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🔧 PR Build Artifacts

Version: 4545ab5

All environments built successfully. Download the zip files:

Artifacts expire after 7 days. View workflow run

@gskjold gskjold added this to the v2.6.1 milestone Nov 26, 2026
@gskjold
gskjold merged commit 985fa76 into main Dec 4, 2026
8 checks passed
@gskjold
gskjold deleted the fix/iskra-celje-22-field branch December 4, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant