# Generic Push Integration

The **Generic Push** integration flow allows you to connect custom hardware, local automation tools (like Node-RED or Home Assistant), or any device capable of making standard HTTP requests to the HEMS platform.

> **Supported Devices**: Currently, the Generic Push integration is designed specifically for **electric meters**, or any device that publishes active power and energy metrics (such as batteries or inverters).


## How it works

When you link a user using the `generic-push` vendor ID, the API generates a unique **PUSH URL**. You must configure your device or automation script to periodically send POST requests to this exact URL with the device's telemetry data.

## Request Format

Your device or script should send an HTTP `POST` request to the generated PUSH URL with a JSON payload.

**Headers Required**:

- `Content-Type`: `application/json`


### Payload Schema

The body of the POST request must conform to the following schema:

| Field | Type | Required | Description |
|  --- | --- | --- | --- |
| `device_id` | string | Yes | A unique identifier for the specific device. (minimum of 1 character) |
| `total_act_power` | number | Yes | The total active power currently consumed/produced, in watts (W). |
| `device_model` | string | No | The model name of the device. |
| `total_act_energy` | number | No | The total active energy accumulated, in watt-hours (Wh). |
| `total_act_ret_energy` | number | No | The total active returned energy, in watt-hours (Wh). |


### Example Request

```bash
curl -X POST "https://api-hems.obeliskapp.com/integration/generic-push?id=<generated-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id": "custom-meter-01",
    "device_model": "HomeAssistant-Virtual",
    "total_act_power": 1450.5,
    "total_act_energy": 50420
  }'
```

## Implementation Tips

- **Frequency**: We recommend pushing data at a sensible interval, such as every 15 or 20 seconds up to 5 minutes, depending on the capabilities of your device and the precision required.
- **Unique Device ID**: The `device_id` must be unique per physical device being tracked under the specific user. If you send data from multiple distinct devices to the same URL, differentiate them by their `device_id`.