|
9 | 9 |
|
10 | 10 | _Integration to integrate with [monta][monta]._ |
11 | 11 |
|
12 | | -**This integration will set up the following platforms.** |
| 12 | +**This integration sets up the following:** |
13 | 13 |
|
14 | | -Platform | Description |
| 14 | +Platform | Entities |
15 | 15 | -- | -- |
16 | | -`binary_sensor` | Show something `True` or `False`. |
17 | | -`sensor` | Show info from Monta API. |
18 | | -`switch` | Switch something `True` or `False`. |
19 | | -`services` | `start_charging` and `stop_charging`` |
| 16 | +`binary_sensor` | Cable Plugged In |
| 17 | +`sensor` | Charge point Visibility, Type, State, Last meter reading (kWh), Last Charge (with attributes), Personal Wallet amount, Latest Wallet Transactions |
| 18 | +`switch` | Charger Start/Stop |
| 19 | +`services` | `start_charging` and `stop_charging` |
20 | 20 |
|
21 | 21 | ## Installation |
22 | 22 |
|
@@ -59,6 +59,52 @@ Client id and secret are obtained from https://portal2.monta.app/applications. |
59 | 59 |
|
60 | 60 | <!----> |
61 | 61 |
|
| 62 | +## Rate limiting and update cadence |
| 63 | +- The integration respects Monta Public API rate limits and HTTP 429 responses. |
| 64 | +- On 429, it reads `context.rateLimitResponse.resetsIn` from the response JSON body and backs off accordingly. It does not rely on `Retry-After` or other rate-limit headers. |
| 65 | +- To reduce bursts: |
| 66 | + - Charge points are fetched at setup and cached, then refreshed infrequently (default every 60 minutes). |
| 67 | + - Wallet and transactions refresh every 5 minutes by default. |
| 68 | + - Charges (latency-sensitive) refresh every 30 seconds, staggered across multiple charge points to stay well under quota. |
| 69 | +- When backing off due to a 429, you will see an INFO log and the coordinator temporarily increases its update interval (capped at 5 minutes) and then recovers automatically. |
| 70 | + |
| 71 | +## Entities and services |
| 72 | + |
| 73 | +- Charge point sensors |
| 74 | + - Visibility: `public` or `private` |
| 75 | + - Type: `ac` or `dc` |
| 76 | + - State: charger state (enum) |
| 77 | + - Last meter reading: cumulative energy (kWh) |
| 78 | + - Last Charge: exposes latest charge state; attributes include timestamps like `startedAt`, `stoppedAt`, etc. |
| 79 | +- Wallet sensors |
| 80 | + - Personal Wallet amount (with `credit` attribute when available) |
| 81 | + - Latest Wallet Transactions: attributes include a parsed list of recent transactions |
| 82 | +- Binary sensors |
| 83 | + - Cable Plugged In |
| 84 | +- Switches |
| 85 | + - Start/Stop charging |
| 86 | +- Services |
| 87 | + - `monta.start_charging` and `monta.stop_charging` |
| 88 | + - Both accept a `charge_point_id` (select your charger device in the UI Service call dialog to populate it) |
| 89 | + |
| 90 | +## Development |
| 91 | + |
| 92 | +- Quick test: `scripts/develop` launches HA with this integration and local `config/`. |
| 93 | +- Setup tooling: `scripts/setup` installs Python deps (HA, Ruff, etc.). |
| 94 | +- Lint: `scripts/lint` runs Ruff checks and autofixes style. |
| 95 | +- In HA UI, add the Monta integration and supply Client ID/Secret. |
| 96 | +- Validate that entities appear and update; watch logs for any rate-limit backoff messages. |
| 97 | + |
| 98 | +## Troubleshooting |
| 99 | + |
| 100 | +- 429 Too Many Requests |
| 101 | + - The integration automatically backs off based on Monta’s `resetsIn` hint and resumes normal cadence afterward. |
| 102 | + - You may see: `Rate limited by API. Backing off update interval to …` in logs. |
| 103 | +- Authentication |
| 104 | + - If credentials are invalid or tokens expire, HA will surface a config entry auth error; reconfigure the integration. |
| 105 | +- Privacy |
| 106 | + - Access/refresh tokens are stored using HA’s Storage (`.storage/`) and sensitive fields are redacted from logs. |
| 107 | + |
62 | 108 | ## Contributions are welcome! |
63 | 109 |
|
64 | 110 | If you want to contribute to this please read the [Contribution guidelines](CONTRIBUTING.md) |
|
0 commit comments