Skip to content

Extend tariff 1 & 2 counter coverage to DSMR and more DLMS paths - #1199

Merged
gskjold merged 2 commits into
mainfrom
feature/tariff-counters-dsmr
Jun 12, 2026
Merged

gskjold merged 2 commits into
mainfrom
feature/tariff-counters-dsmr

Conversation

@gskjold

@gskjold gskjold commented Jun 12, 2026

Copy link
Copy Markdown
Member

Follow-up to #1136, which added Tariff 1 & 2 import/export counters but only sourced them from the LNG parser and one IEC6205675 (Iskra) list path. This PR extends the same counters to the remaining payload types that expose tariff registers.

Changes

DSMR / P1 (IEC6205621)

The most common dual-tariff family (NL/BE/LU day–night meters). The parser already read 1.8.1/1.8.2 and 2.8.1/2.8.2 but only summed them into the totals — the per-tariff breakdown was discarded (the same "read but not stored" bug #1136 fixed for LNG).

  • Read 1.8.1/1.8.2 and 2.8.1/2.8.2 into the tariff counters, guarded so absent registers don't zero known values.
  • Apply accumulatedMultiplier scaling to the tariff counters, matching the totals.

DLMS (IEC6205675)

  • Wired up the AMS_OBIS_*_COUNT_T1/T2 OBIS constants in the generic OBIS-lookup path. Add tariff counter support (Tariff 1 & 2) for import/export #1136 declared these constants but never used them; now any list exposing 1.8.1/1.8.2/2.8.1/2.8.2 via OBIS tags populates the tariff counters.
  • Store export tariff values in the Iskra export-list path that already parsed obis281/282.
  • Apply accumulatedMultiplier scaling to the tariff counters.

Output

No new plumbing needed — the MQTT (tPIT1/tPIT2/tPOT1/tPOT2), Raw (.../tariff1, .../tariff2), and UI (ict1/ict2/ect1/ect2) layers from #1136 read the AmsData tariff getters, so these parsers' values flow through automatically.

Scope / deliberately left alone

  • IEC6205675 list paths that only read 1.8.0/2.8.0 totals, or that skip the tariff positions with uncertain (commented ?) layout, are untouched — adding reads there without validated payloads risks writing garbage into tariff counters.
  • LNG2 and the Kamstrup (KMP) driver expose only total registers — nothing to source.

Testing

  • Builds: esp32 and esp8266 both succeed.
  • No host unit test: the native decoder harness isn't on main (it comes with the planned restructure), and IEC6205621 is built on Arduino String. Verified by build + code review against the OBIS register definitions. Real-meter validation (DSMR dual-tariff + an Iskra) recommended before release.

gskjold and others added 2 commits June 12, 2026 10:17
DSMR/P1 meters report 1.8.1/1.8.2 and 2.8.1/2.8.2 but the parser only
summed them into the totals. Read the per-tariff registers into the
tariff counters (guarded so absent registers don't zero known values),
and apply accumulatedMultiplier scaling to them for consistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Wire up the AMS_OBIS_*_COUNT_T1/T2 constants in the generic OBIS-lookup
  path so any list exposing 1.8.1/1.8.2/2.8.1/2.8.2 populates the tariff
  counters (these constants were previously declared but unused).
- Store export tariff values in the Iskra export-list path that already
  parsed obis281/282.
- Apply accumulatedMultiplier scaling to the tariff counters, matching the
  totals.

Paths that only read 1.8.0/2.8.0 totals, or skip the tariff positions with
uncertain (commented '?') layout, are left untouched pending real payloads.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

🔧 PR Build Artifacts

Version: e1d6bfe

All environments built successfully. Download the zip files:

Artifacts expire after 7 days. View workflow run

@gskjold
gskjold merged commit 0018079 into main Jun 12, 2026
7 checks passed
@gskjold
gskjold deleted the feature/tariff-counters-dsmr branch June 12, 2026 08:25
@chax

chax commented Jul 30, 2026

Copy link
Copy Markdown

I have an Iskra IE.5 which supports two tarrif couters (obis codes 1.8.1 and 1.8.2). I made test build from main branch (commit 4bcc708) but it still shows only sum of those two tarrifs (T1 + T2). If you need me for testing/verification, just let me know, I'm willing to flash test firmwares myself. I'm using custom hardware based on ESP32-C3.

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.

2 participants