# JSON-RPC API Supported ETM PowerSync exposes **nymea's JSON-RPC API** locally, extended with the ETM namespaces (`Energy`, `AirConditioning`, `EvDash`). --- ## Connection | Mode | Address | Notes | | --- | --- | --- | | **Raw TCP** | `:2222` | The server sends a JSON welcome message (`\n`-delimited) on connect | | **WebSocket** | `ws://:4444` | The client sends `JSONRPC.Hello` first | Every message is a JSON object terminated by `\n`. Requests carry an `id` field (integer) to match the reply. Notifications have no `id`. --- ## Authentication 1. Call [`JSONRPC.Authenticate`](../api/metier/jsonrpc.md#jsonrpcauthenticate) with `username`, `password` and `deviceName` → the server answers with a `token`. 2. Include the `token` in every subsequent request. 3. To receive notifications: call `JSONRPC.SetNotificationStatus` with `{ "namespaces": ["Energy", "Integrations", ...] }`. --- ## Energy conventions | Quantity | Convention | | --- | --- | | PV output | **negative value** (producer convention) | | `currentPowerAcquisition` | grid — positive = import, 0 when exporting | | `currentPowerStorage` | battery — positive = charging, negative = discharging | | Energy totals | in **kWh** | | Timestamps | in **seconds** (Unix epoch) | --- ## Permission badges | Badge | Scope | Description | | --- | --- | --- | | AUTH | `PermissionScopeNone` | Any authenticated account (token required whenever the transport requires authentication; only `JSONRPC.Hello`, `Authenticate` and `RequestPushButtonAuth` work without one) | | CONTROL | `PermissionScopeControlThings` / `ExecuteRules` | Control of things and rules | | CONFIGURE | `PermissionScopeConfigureThings` / `ConfigureRules` | Configuration of integrations and rules | | ADMIN | `PermissionScopeAdmin` | System administration | --- ## Full reference → [JSON-RPC API reference](../api/index.md)