Skip to content

Add tariff counter support (Tariff 1 & 2) for import/export#1136

Open
matlab22 wants to merge 1 commit intoUtilitechAS:mainfrom
matlab22:feature/tariff-counters
Open

Add tariff counter support (Tariff 1 & 2) for import/export#1136
matlab22 wants to merge 1 commit intoUtilitechAS:mainfrom
matlab22:feature/tariff-counters

Conversation

@matlab22
Copy link
Copy Markdown

@matlab22 matlab22 commented Feb 8, 2026

Adds support for separate tariff-based accumulated energy counters (Tariff 1 and Tariff 2) for both active import and export. Enables detailed tracking of energy consumption across different rate periods.

Fixes: Landis+Gyr parser bug where tariff values were read from meter but not stored.

Changes

Core Data Model

  • AmsData.h/cpp: Added activeImportCounterTariff1/2 and activeExportCounterTariff1/2 fields with getters
  • Modified apply() methods to handle OBIS tariff values (gr=8, tariff=1/2) and copy tariff counters between instances

Meter Parsers

  • IEC6205675.h/cpp: Added OBIS constants and parsing for 1.8.1, 1.8.2, 2.8.1, 2.8.2 (Iskra meters)
  • LNG.cpp: Fixed bug - parser now stores tariff values (o181, o182, o281, o282) instead of only summing them

MQTT Integration

  • JsonMqttHandler.cpp: Added tPIT1, tPIT2, tPOT1, tPOT2 fields to list3/list4 JSON
  • RawMqttHandler.cpp: Added topics for /meter/import/export/active/accumulated/tariff1 and /tariff2

Web UI

  • data.json: Added ict1, ict2, ect1, ect2 fields to data API
  • AmsWebServer.cpp: Populated tariff counter values in JSON response
  • Dashboard.svelte: Display tariff breakdown below total counters (only when tariff data present)
image

Compatibility

  • Fully backward compatible
  • Existing integrations continue with total counters (tPI, tPO)
  • Tariff fields only display when meter provides non-zero values

Testing

  • Tested on ESP32-C3 with Landis+Gyr meter
  • Verified MQTT JSON/Raw outputs
  • Confirmed UI displays tariff breakdown
  • Validated DLMS/HDLC parsing

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