ANSI C12.18 reader - #1231
Open
Xento wants to merge 7 commits into
Open
Conversation
Add an ESP32 MeterCommunicator for ANSI C12.18 optical meters with session setup, CRC-checked framing, multi-packet response handling and automatic UART recovery after repeated failures. Read byte order from table 0, energy counters from table 23 and standard or extended measurements from table 28. Publish the decoded values through the existing AmsData OBIS path so MQTT and Home Assistant need no protocol-specific changes. Store user ID, username, password and the extended-table option in a separate backwards-compatible EEPROM block, and expose these settings in the existing web configuration UI. Validated with npm run build and PlatformIO builds for esp32 and esp8266.
Implement ANSI C12.18 channel and inter-character timeouts, three link-layer retries, ACK/NACK turnaround, negotiated packet parameters, duplicate detection, sequence validation, and optional-service fallbacks.
Keep energy values on the fast poll cycle and refresh extended table 28 hardware values every 60 seconds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch adds full ANSI C12.18 session-management controls to the firmware and web UI.
It introduces configurable session termination after each meter read, a configurable automatic logoff interval, and a daily idle period. During the idle window, the firmware logs off any active session and does not start new meter queries.
Supported meter types
The C12.18 implementation is intended for OSGP-compatible optical smart meters, including: