docs(integration-toolkit): always map a counter direction - #152
Merged
Conversation
`direction` is part of how a meter reading is stored and queried, so every reading is persisted with one. Document the resolution order (reading -> counter -> derived from OBIS), and that mapping it straight through when the ERP sends the key empty writes an empty attribute and defeats the `meter_counter` schema default — defaults only fill attributes that are absent, not ones present and empty. One org accumulated 132,722 direction-less counters this way; 621,747 of its water and heat readings were rejected before metering gained an OBIS fallback. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Adds a Counter Direction section to the inbound meter-readings page.
directionis part of how a reading is stored and queried — every reading is persisted with one — but nothing in the docs said so, and the obvious mapping is a trap.Covers:
direction→ the counter's → derived from the counter'sobis_number. Set it at step 1 or 2; step 3 is a safety net, not a plan.obis_numberis in scope) and the constant form for single-direction use cases — plus the warning that a direction on the reading wins over the counter's, so a blanket constant will relabel feed-in readings.{ "attribute": "direction", "field": "direction" }assigns unconditionally, so an ERP sending the key empty writes an empty attribute and themeter_counterschema'sfeed-outdefault never applies — entity-api only defaults attributes that are absent.Why now
One org accumulated 132,722 direction-less counters through a straight-through mapping; 621,747 of its water and heat readings were rejected and dropped over 31h before metering-api gained the OBIS fallback (metering-api!241).
🤖 Generated with Claude Code