Repository navigation
feat(calin-meter-v2): add Calin Meter API V2 (AMR) plugin - #1781
Open
beesaferoot wants to merge 9 commits into
Open
beesaferoot wants to merge 9 commits into
beesaferoot wants to merge 9 commits into
Conversation
Newer Calin installations run Calin's API V2 (AMR), each on its own host and port. Adds a CalinMeterV2 manufacturer plugin next to the existing Calin plugins instead of rewriting CalinSmartMeter in place, so tenants on the older APIs keep vending. - Logs in for a JWT, keeps the access token and logs in again once it expires. - Vends kWh tokens and records the units Calin reports it issued. - Issues clear credit tokens and checks whether a meter is registered on Calin, for the ad-hoc device control. - Saves credentials only after Calin accepts a login with them. An optional company name is sent at login when set. - Corrects common address mistakes: a trailing /api is dropped, and a web dashboard address is replaced by the API address the dashboard names. - Credentials page with the same status card as Spark SHS, sidebar entry, locale labels and docs. Refs #1726
…password - add a "Vend by" setting: energy (default) or amount paid, where Calin applies the tariff stored on its side - send an optional authorization password with vend requests, for systems that ask for one - document both in the plugin's page Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
3 tasks done
Contributor
|
I pushed one commit on top of your branch:
Tested against our two live installations, from a local instance:
One thing to sort out: this branch uses plugin id 34, the same as #1779. #1780 and #1782 use 35 and 36. Whichever is merged later needs a new id. I used Claude Code for the changes. |
93Kamuran
removed their request for review
November 26, 2026 12:24
Contributor
|
I removed myself as reviewer, since part of this PR is my own code. @dmohns, it is ready for your review: CI is green and it was tested against our two live installations (see the comment above). |
Register the plugin by slug (calin_meter_v2) as introduced in #1777. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts: # src/backend/bootstrap/providers.php
# Conflicts: # src/backend/tests/Feature/MpmPluginCatalogTest.php
# Conflicts: # src/backend/bootstrap/providers.php # src/backend/tests/Feature/MpmPluginCatalogTest.php # src/frontend/src/ExportedRoutes.js
Contributor
|
Branch updated to current main. This plugin has been running in production since 3 December and is vending tokens for live customers. @dmohns, could you take a look when you have time? |
This branch has not been deployed
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.
Brief summary of the change made
closes: #1726
closes: #1776
Newer Calin installations run Calin's API V2 (AMR), each on its own host and port.
This PR adds a
CalinMeterV2manufacturer plugin for them.It covers both STS keypad meters and smart meters on API V2.
An optional company name is sent at login when set.
isVendByTotalPaid: true) and Calin applies the tariff stored on its side.In both modes the units Calin reports (
totalUnit) are recorded./apiis dropped, and a web dashboard address is replaced by the API address the dashboard names.The plugin was started by @beesaferoot; the vend mode setting and the authorization password were added by me.
Are there any other side effects of this change that we should be aware of?
No.
The legacy
CalinMeterandCalinSmartMeterplugins are not changed.This branch uses plugin id 34, the same as #1779; #1780 and #1782 use 35 and 36.
Whichever is merged later needs a new id.
Describe how you tested your changes?
composer quality:checkpasses; ESLint and Prettier pass.Incorrect authorization password (code 99).With it, a payment of 1,000 at a tariff of 1,830 returned a token and
totalUnit0.5.totalUnit1.The meter lookup (
/api/meter/read) returned the meter as registered.AI disclosure
I used Claude Code for the vend mode setting, the authorization password and their tests and documentation.
Pull Request checklist